|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-03-08 06:48 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 18:00:01 2025 UTC |
$objectlist=array(); class MyClass { function MyClass() { global $objectlist; // Save the reference for later use $objectList[]=&$this; } }; // the object referred to by $myobject is NOT in the array $myobject = new MyClass(); // $myobject2 exists in the array $myobject2 =& new MyClass(); It appears that there is an object being copied when returning from the constructor. What am I doing wrong? I'm not supposed to return anything from the constuctor.