Curt Zirzow wrote:
* Thus wrote Andrew Nagy:
How do you use the call_user_func function with call-time
pass-by-reference deprecation?
For example:
function fun(&$arg) {
$arg++;
}
$var = 0;
call_user_func("fun", $var);
echo $var; //echoes 0 instead of 1
$func_call = 'fu
Tom Rogers wrote:
> Sorry about that, I checked it in cli and it doesn't give a warning.
> This is another way:
>
> function fun($arg) {
> $arg++;
> }
> $var = 0;
> call_user_func_array("fun", array(&$var));
> echo $var;
Hmm ... this still echos 0 and not 1. I am using 4.3.7 with all
warn
Tom Rogers wrote:
With call_user_function() you need to do this:
call_user_func("fun", &$var);
Tom, this won't work due to the Call-Time Pass-By-Reference deprecation.
Does anyone know how to do this?
The error message says "If you would like to pass it by reference,
modify the declaration of c
r);
Thanks for any help with this!
Andrew Nagy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
4 matches
Mail list logo