Get and object reference??

From: Date: Fri, 18 Oct 2002 17:55:17 +0000
Subject: Get and object reference??
Groups: php.general 
Request: Send a blank email to php-general+get-120539@lists.php.net to get a copy of this message
Greetings, Can anyone tell me why the following still creates a *copy* of the object?? Thanks, Matthew <?php $aFunctions = array(); $oTest = new test; $oTest->sText = "The original object."; print "<pre>"; foreach ( array_keys($aFunctions) as $iKey ) call_user_func($aFunctions[$iKey]); $oTest->callme(); print "</pre>"; class test { var $sText; function test() { GLOBAL $aFunctions; $this->sText = "A copy of the object!"; /* This make a COPY of the Object, not a Reference! */ $aFunctions[] = array(&$this, 'callme'); } function callme() { print $this->sText . "\n"; return; } } ?>

« previous php.general (#120539) next »