|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2014-06-11 04:28 UTC] requinix@php.net
 
-Status: Open
+Status: Not a bug
  [2014-06-11 04:28 UTC] requinix@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 21:00:02 2025 UTC | 
Description: ------------ Access the array using foreach, the first time is foreach($list as &$row) for the second time is foreach($list as $row) this time $row values are incorrect Test script: --------------- $list = array( array("x" => 1), array("x" => 3) ); foreach($list as &$row) { if ($row["x"] == 1) $row["y"] = 10; } foreach($list as $row) { var_dump($row); } Expected result: ---------------- array(2) { ["x"]=> int(1) ["y"]=> int(10) } array(1) { ["x"]=> int(3) } Actual result: -------------- array(2) { ["x"]=> int(1) ["y"]=> int(10) } array(2) { ["x"]=> int(1) ["y"]=> int(10) }