Re[2]: [PHP] call_user_func and call-time pass-by-reference
| From: | Tom Rogers | Date: | Sat, 03 Jul 2004 02:00:10 +0000 |
| Subject: | Re[2]: [PHP] call_user_func and call-time pass-by-reference | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-189603@lists.php.net to get a copy of this message | ||
Hi,
Saturday, July 3, 2004, 3:00:22 AM, you wrote:
AN> Tom Rogers wrote:
>>With call_user_function() you need to do this:
>>
>>call_user_func("fun", &$var);
>>
>>
AN> Tom, this won't work due to the Call-Time Pass-By-Reference deprecation.
AN> Does anyone know how to do this?
AN> The error message says "If you would like to pass it by reference,
AN> modify the declaration of call_user_func()" ... how would i do this?
AN> Andrew
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;
--
regards,
Tom