|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-12-17 03:15 UTC] levi at alliancesoftware dot com dot au
[2004-12-17 09:36 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 22 08:00:02 2025 UTC |
Description: ------------ Below code work with PHP 4.3.9!!! Reproduce code: --------------- class A{ protected $value = 0; function A($value){ $this->value = $value;} function getValue(){ return $this->value;} function setValue($value){ $this->value = $value;} } $b = array(); $a = new A(0); for($i = 1; $i <= 2; $i++){ $a->setValue($i); $b[] = $a;} print_r($b); Expected result: ---------------- Array ( [0] => A Object ( [value:protected] => 1 ) [1] => A Object ( [value:protected] => 2 ) ) Actual result: -------------- Array ( [0] => A Object ( [value:protected] => 2 ) [1] => A Object ( [value:protected] => 2 ) )