I was looking in _PHP Cookbook_ by David Sklar and Adam Trachtenberg
from O'Reilly. On page 155 under "Assigning Object References" it
says, "Problem: You want to link two objects, so when you update one,
you update the other. Solution: Use =& to assign one object to another
by reference ... When you do an object assignment using =, you create a
new copy of an object ... But when you use =&, the two objects point at
each other."
I thought that when you use =& the thing on the left is a *variable*,
not an object, and that it points to the thing on the right, which is
usually an object. There is no "pointing at each other".
In the PHP manual
(
http://www.php.net/manual/en/languag...es.whatdo.php), they go
to great lengths to specifically emphasize this distinction...
<quote>
<?php
$a =& $b;
?>
it means that $a and $b point to the same content.
Note: $a and $b are completely equal here, that's not $a is pointing to
$b or vice versa, that's $a and $b pointing to the same place.
</quote>
Is the book just wrong, or am I not understanding this correctly?
I would be interested to hear others' comments.
Thanks,
E