Reference problem... (got bounced from php.bugs #33984)
| From: | Andrey Nikolaev | Date: | Wed, 03 Aug 2005 19:07:17 +0000 |
| Subject: | Reference problem... (got bounced from php.bugs #33984) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-219951@lists.php.net to get a copy of this message | ||
I'm not php noobie, but still can't understand this behaviour of references.
Anybody can show me where the hell is it documented ?
Or show any logical conclusions why is it act like this... Just anything.
Thanks.
Description:
------------
See reproduce code.
Reproduce code:
---------------
<?php
class A {}
class RefTest {
function RefTest() {
$this->a = new A;
$this->b =& $this->a;
}
}
$rt = new RefTest();
var_dump($rt);
?>
Expected result:
----------------
object(reftest)(2) {
["a"]=>
object(a)(0) {
}
["b"]=>
&object(a)(0) {
}
}
Actual result:
--------------
object(reftest)(2) {
["a"]=>
&object(a)(0) {
}
["b"]=>
&object(a)(0) {
}
}