|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-02-07 12:45 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 10:00:01 2025 UTC |
Description: ------------ When a reference to a variable (containing e.g. a literal or an object) is inserted into an array, all existing references in this array becomes references to this variable. Reproduce code: --------------- $t = NULL; $node = '1'; // or $node = new Object(); $t[] = &$node; $node = '2'; // or $node = new Object(); $t[] = &$node; var_dump($t); Expected result: ---------------- array(2) { [0]=> &string(1) "1" [1]=> &string(1) "2" } Actual result: -------------- array(2) { [0]=> &string(1) "2" [1]=> &string(1) "2" }