考虑这个
PHP代码:
call_user_func(array(&$this,'method_name'),$args);
我知道这是指定义函数时的传递参考,但是在调用函数时是否正确?
从
Passing By Reference文档页面:
You can pass a variable by reference
to a function so the function can
modify the variable. The Syntax is as
follows:
<?PHP function foo(&$var) { $var++; } $a=5; foo($a); // $a is 6 here ?>
…In recent versions of PHP you will get a warning saying that “call-time pass-by-reference” is deprecated when you use & in foo(&$a);