note 58109 deleted from language.oop5.overloading by danielc
| From: | danielc@php.net | Date: | Thu, 03 Jul 2008 00:35:07 +0000 |
| Subject: | note 58109 deleted from language.oop5.overloading by danielc | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141097@lists.php.net to get a copy of this message | ||
Note Submitter: divedeep at yandex dot ru
Reason: 0
----
Small examle showing how to work with magic method __call and parameters, that u want to pass as a
reference.
DOES NOT WORK:
<?php
class a {
public function __call($m,&$p) {
$p[0]=2;
}
}
$a= new a();
$b=1;
$a->foo($b);
echo $b;
// RETURNS 1
?>
WORKS:
<?php
class a {
public function __call($m,$p) {
$p[0]=2;
}
}
$a= new a();
$b=1;
$a->foo(&$b);
// RETURNS 2
echo $b;
?>