|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-11-12 18:57 UTC] tony2001@php.net
[2006-11-12 21:06 UTC] phpbug dot 20 dot antialias at spamgourmet dot com
[2006-11-12 21:24 UTC] tony2001@php.net
[2006-11-12 21:34 UTC] phpbug dot 20 dot antialias at spamgourmet dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 20:00:01 2025 UTC |
Description: ------------ foreach iterators are bound to the scope of their arrays. This causes problems when a global array has been partially iterated through, and then inside the foreach, the same global array is iterated through again. The the inner foreach iterator effectively completes the iterations of the outer foreach iterator, yielding unexpected results. Reproduce code: --------------- $t = array("1", "2"); global $t; foreach($t as $a) { foreach($t as $b) { echo $b; } echo $a; } Expected result: ---------------- 1212 Actual result: -------------- 121