Re: call_user_func and call-time pass-by-reference
| From: | Tom Rogers | Date: | Fri, 02 Jul 2004 16:48:39 +0000 |
| Subject: | Re: call_user_func and call-time pass-by-reference | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-189549@lists.php.net to get a copy of this message | ||
Hi,
Saturday, July 3, 2004, 2:02:42 AM, you wrote:
AN> How do you use the call_user_func function with call-time
AN> pass-by-reference deprecation?
AN> For example:
AN> function fun(&$arg) {
AN> $arg++;
AN> }
AN> $var = 0;
AN> call_user_func("fun", $var);
AN> echo $var; //echoes 0 instead of 1
AN> Is their anyway to do this:
AN> call_user_func("fun", &$var);
AN> Thanks for any help with this!
AN> Andrew Nagy
With call_user_function() you need to do this:
call_user_func("fun", &$var);
--
regards,
Tom