Re: [PHP4BETA] problem: references

[email protected] (Alexander Meurer) Wed, 31 May 2000 15:53:49 +0200
Newsgroups php.version4
Message-ID <[email protected]>
Hi,

this code below works, if you modify

$r = &$this->x;

to

$r = $this->x;

Then the result is 10 (as expected)!

Ciao
  Alex

> DM>> <?
> DM>>     class test {
> DM>>         var $x;
> DM>>         function getx (&$r) {
> DM>>             $r = &$this->x;
> DM>>         }
> DM>>     }
> DM>>
> DM>>     $v = "some text";
> DM>>     $t = new test;
> DM>>     $t->x = 10;
> DM>>     $t->getx ($v);
> DM>>     print ("test=$v");
> DM>> ?>
> DM>>
> DM>> and result is ... "some text" !!!