Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- O'Reilly PHP Cookbook in error?
July 18, 2005, 6:17 am
rate this thread
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
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/language.references.whatdo.php ), they go
to great lengths to specifically emphasize this distinction...
$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.
Is the book just wrong, or am I not understanding this correctly?
I would be interested to hear others' comments.
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum