|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-01-15 10:12 UTC] kobieta dot ryba at gmail dot com
[2009-02-10 11:00 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 28 16:00:01 2025 UTC |
Description: ------------ I've noticed strange behavior when using references and foreach loop. It throws an error "Invalid argument supplied for foreach" but if the code // $ass = &$array; is commented out, the result is as expected: Output: in in in Reproduce code: --------------- <? $array = array("1", "2", "3"); $ass = &$array; foreach($array as $k => &$v) { $array = false; $v = "Test"; echo "in\n"; } ?> Expected result: ---------------- in in in Actual result: -------------- in Warning: Invalid argument supplied for foreach() in test.php on line 5