|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-11-17 22:43 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2018-11-17 22:43 UTC] requinix@php.net
[2018-11-17 22:57 UTC] spam2 at rhsoft dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 08:00:01 2025 UTC |
Description: ------------ When foreaching array of arrays referenced, the last index will remain pointer to the second last index afterwards. Test script: --------------- <?php $arrays = [ [1,3,2], [2,8,3], [10,8,9], ]; foreach ($arrays as &$array) { echo 'First: ' . implode(', ', $array) . PHP_EOL; } $arrays[1] = [3,3,3]; foreach ($arrays as $array) { echo 'Second: ' . implode(', ', $array) . PHP_EOL; } Expected result: ---------------- Last index would act same way the others do. Actual result: -------------- Last index is now reference to second last index.