note 61748 added to language.oop5.overloading
| From: | derek-php at seysol dot com | Date: | Fri, 10 Feb 2006 20:08:32 +0000 |
| Subject: | note 61748 added to language.oop5.overloading | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-103469@lists.php.net to get a copy of this message | ||
Please note that PHP5 currently doesn't support __call return-by-reference (see PHP Bug
#30959).
Example Code:
<?php
class test {
public function &__call($method, $params) {
// Return a reference to var2
return $GLOBALS['var2'];
}
public function &actual() {
// Return a reference to var1
return $GLOBALS['var1'];
}
}
$obj = new test;
$GLOBALS['var1'] = 0;
$GLOBALS['var2'] = 0;
$ref1 =& $obj->actual();
$GLOBALS['var1']++;
echo "Actual function returns: $ref1 which should be equal to " .
$GLOBALS['var1'] . "<br/>\n";
$ref2 =& $obj->overloaded();
$GLOBALS['var2']++;
echo "Overloaded function returns: $ref2 which should be equal to " .
$GLOBALS['var2'] . "<br/>\n";
?>
----
Server IP: 64.71.164.2
Probable Submitter: 208.242.45.243
----
Manual Page -- http://www.php.net/manual/en/language.oop5.overloading.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61748
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61748&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61748&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61748&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61748&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61748&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61748&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61748&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61748&report=yes
Search -- http://master.php.net/manage/user-notes.php