|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-11-23 20:39 UTC] lbarnaud@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 16:00:02 2025 UTC |
Description: ------------ When setting an a particular array element to the array itself, results are different when it's inside a function vs outside the function. Reproduce code: --------------- function func() { $a[1] = '1'; $a[0] = $a; var_dump($a); } func(); $a[1] = '1'; $a[0] = $a; var_dump($a); Expected result: ---------------- I'm not sure what to expect but at the vary least, the results should be consistent. Results were consistent in 5.2.1. array(2) { [1]=> string(1) "1" [0]=> array(1) { [1]=> string(1) "1" } } array(2) { [1]=> string(1) "1" [0]=> array(1) { [1]=> string(1) "1" } } Actual result: -------------- array(2) { [1]=> string(1) "1" [0]=> NULL } array(2) { [1]=> string(1) "1" [0]=> array(1) { [1]=> string(1) "1" } }