|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-26 10:50 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 22:00:01 2025 UTC |
Description: ------------ PHP 5.1.1 is the last version of PHP which gave expected result of this statement. I noticed that next versions return wrong result. I tested PHP version 5.1.2, 5.1.4, 5.1.6 and the all returned unexpected (wrong) result. As you can see, the mistake appeares when you assign value to the variable which is passed to function as a reference: In my example: test($i=array()); Reproduce code: --------------- <? function test(&$x) { $x[]=1; $x[]=2; $x[]=3; } test($i=array()); $i[]=4; var_dump($i); ?> Expected result: ---------------- array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) } Actual result: -------------- array(1) { [3]=> int(4) }