|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-01-09 01:10 UTC] ajf@php.net
-Package: Feature/Change Request
+Package: Arrays related
-Operating System: WindowsXP
+Operating System: *
-PHP Version: 5.2.5
+PHP Version: *
[2020-04-11 13:43 UTC] cmb@php.net
-Status: Open
+Status: Suspended
[2020-04-11 13:43 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 14:00:01 2025 UTC |
Description: ------------ Suggestion is to support foreach() to iterate actoss multidimensional arrays. Given a higher-order array, it would be very useful to be able to collapse nested foreach statements into a single one. To exemplify: given $A[1][1]="A"; $A[1][2]="B"; $A[1][3]="C"; $A[2][1]="D"; etc. foreach($A as $L1,$L2 => $V) { // first iteration -- $L1=1, $L2=1, $V="A" // second iteration -- $L1=1, $L2=2, $V="B" // third iteration -- $L1=1, $L2=3, $V="C" // fourth iteration -- $L1=2, $L2=1, $V="D" } I would have many uses for such a construct, and I'm hoping that I would not be alone. KR