PHP Objects & References
Posted on 2007-10-12
I have 2 quick questions about references in PHP, firstly, if i did the following:
$this->object = new Object();
$var1 = $this->object;
Would $var1 contain a copy of $this->object, and hence clone it?
Secondly, If I did the following:
$ref =& $this->object;
$secondref = $ref;
Does that mean $secondref is a reference to $this->object ($secondref is set to the same memory location as $ref is set to)? Or does PHP treat $ref as the same as $this->object and hence would not contain a reference to it and possibly duplicate it?
Thanks for your help,