note 69802 deleted from language.references.return by bobby
| From: | bobby@php.net | Date: | Thu, 21 Sep 2006 20:37:59 +0000 |
| Subject: | note 69802 deleted from language.references.return by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-117394@lists.php.net to get a copy of this message | ||
Note Submitter: taylorbarstow at that google mail thingy
----
Return by reference does not appear to work for the __call() magic method of PHP5 (5.1.5).
Try the following example:
<?php
class MyTest {
public $foo='foo';
function &__call($func,$args) {
return $this->foo;
}
}
$test = new MyTest;
$foo =& $test->getAReferenceToTheVarNamedFoo();
$foo = 'bar';
echo "foo is: $test->foo";
?>
Output: "foo is: foo"
If return by reference with __call() worked, it would output: "foo is: bar"