Passing by reference, assigning by reference?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux