On Jan 11, 5:16 pm, Richard Clark <[email protected]> wrote:
> The odd bit is that he wrote the article as if he expected it to
> behave differently (ie, that $b would become a reference to $a which
> would be a reference to the object), which is just weird. You were
> never lied to, PHP5 references objects, not other references.

Which is demonstrated by explicitly defining $b as a reference to $a:

<?php
$a = new stdClass;
$b = &$a;
$a->foo = 'bar';
$a = 'baz';
var_dump($b); // outputs "baz";
?>

Annoying how periodically a blogger 'discovers' that references don't
behave like pointers and write breathless posts about bugs in PHP5
object handling.
-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to