Re: [PHP4BETA] problem: references
| From: | Alexander Meurer | Date: | Wed, 31 May 2000 13:53:49 +0000 |
| Subject: | Re: [PHP4BETA] problem: references | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-15977@lists.php.net to get a copy of this message | ||
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" !!!