|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-04-06 06:53 UTC] jack at mobil dot cz
hello foreach ($array as list($a, $b)) ; won't work. is there any hope this will change in future? Patchesphp-5.4.0svn-add-foreach-list-support.patch (last revision 2011-07-06 12:15 UTC by laruence@php.net)php-5.4.0-alpha1-foreach-list-diff.patch (last revision 2011-07-06 05:34 UTC by laruence@php.net) Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 19:00:02 2025 UTC |
It's for someone else to decide whether to add this to the language, but until they do you can achieve the same effect with: $arr = array(array(1, 2), array(3, 4)); foreach ($arr as $narr) { list($a, $b) = array_values($narr); echo "$a, $b\n"; } BTW--it would have helped if you had explained what results you were after and not just the syntax you wanted. ;)