|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-09-29 15:48 UTC] g dot passault at gmail dot com
[2020-09-29 15:50 UTC] fghghghgh at fgfgfg dot com
[2020-09-29 16:05 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2020-09-29 16:05 UTC] cmb@php.net
[2020-09-29 21:02 UTC] g dot passault at gmail dot com
[2020-09-29 21:19 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 22:00:01 2025 UTC |
Description: ------------ For some reason, walking an array using keys and reference values (&), even without doing anything with it and then walking it has an influence if and only if the variable name is the same in both cases Test script: --------------- <?php $array = [ 'x' => 1, 'y' => 2, 'z' => 3 ]; // This useless walk has an effect on below walk foreach ($array as &$item) {} // This will show 1 2 2 instead of 1 2 3 // If you use another name for $item variable, it will show 1 2 3 foreach ($array as $item) { echo $item."\n"; } Expected result: ---------------- 1 2 3 Actual result: -------------- 1 2 2