note 69802 added to language.references.return
| From: | taylorbarstowatthatgooglemailthingy at osu1 dot php dot net | Date: | Thu, 21 Sep 2006 18:51:16 +0000 |
| Subject: | note 69802 added to language.references.return | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117389@lists.php.net to get a copy of this message | ||
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"
----
Server IP: 66.163.161.117
Probable Submitter: 69.84.135.132
----
Manual Page -- http://www.php.net/manual/en/language.references.return.php
Edit -- https://master.php.net/note/edit/69802
Del: integrated -- https://master.php.net/note/delete/69802/integrated
Del: useless -- https://master.php.net/note/delete/69802/useless
Del: bad code -- https://master.php.net/note/delete/69802/bad+code
Del: spam -- https://master.php.net/note/delete/69802/spam
Del: non-english -- https://master.php.net/note/delete/69802/non-english
Del: in docs -- https://master.php.net/note/delete/69802/in+docs
Del: other reasons-- https://master.php.net/note/delete/69802
Reject -- https://master.php.net/note/reject/69802
Search -- https://master.php.net/manage/user-notes.php