note 43478 added to function.call-user-func
| From: | napalm at spiderfish dot net | Date: | Tue, 22 Jun 2004 17:58:36 +0000 |
| Subject: | note 43478 added to function.call-user-func | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-71512@lists.php.net to get a copy of this message | ||
Just a tip that kept me busy for a while.
<?
function fun(&$arg) {
$arg++;
}
$var = 0;
call_user_func("fun", $var);
echo $var; //echoes 0 instead of 1
?>
As you can see the variable passed to "fun" is actually a copy of $var and not the
variable itself.
In this case you have to use other method to call the function.
----
Manual Page -- http://www.php.net/manual/en/function.call-user-func.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43478
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43478&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43478&report=yes
Search -- http://master.php.net/manage/user-notes.php