Passing by reference, assigning by reference?

From: Date: Mon, 05 Sep 2005 10:24:10 +0000
Subject: Passing by reference, assigning by reference?
Groups: php.general 
Request: Send a blank email to php-general+get-221854@lists.php.net to get a copy of this message
Hi sports fans! I have a quick "references" related question. Ok, I'm passing a Page object by reference to another object: myClass->myFunction($objPage); What I want to do is store that Page object as part of the myClass object (see definition code below). My question is this: When assigning the Page object to be a variable of the myClass object do I store a reference to it or a copy of the reference? class myClass() { var $objPage; function myFunction(&$objPage) { // this way (a reference to the reference?): $this->objPage =& $objPage; // or this way (a copy of the reference?): $this->objPage = $objPage; // code, code, code... } } Is there much difference? Does it really matter? I'm unsure if this is efficient or not. Can someone please shed some light on this. Thanks!

« previous php.general (#221854) next »