|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-05-09 10:27 UTC] ies_clan at hotmail dot com
[2008-05-09 10:27 UTC] colder@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 28 17:00:01 2025 UTC |
Description: ------------ If you try to use Variable variables in a foreach, the output of the array is wrong Reproduce code: --------------- $array = Array( 0 => Array('11', '12', '13'), 1 => Array('21', '22', '23'), 2 => Array('31', '32', '33') ); $key = 'key'; $value = 'value'; foreach($array AS ${$key} => ${$value}){ echo ${$key}." -\n"; } Expected result: ---------------- 1 2 Actual result: -------------- 0 1 2