note 90112 added to function.call-user-func-array
| From: | (at) | Date: | Tue, 07 Apr 2009 08:53:58 +0000 |
| Subject: | note 90112 added to function.call-user-func-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152881@lists.php.net to get a copy of this message | ||
I just noticed that when you use this function with parameters that need to be passed by reference
it will not work.
<?php
function refFunc(&$var)
{
$var .= 'bar';
}
$var = 'foo';
?>
call_user_func_array('refFunc', array($var));
echo $var;
will output 'foo' and not 'foobar'. Witch is logical since you are declaring a
new variable with array($var) however not so obvious.
----
Server IP: 213.249.64.162
Probable Submitter: 82.93.82.62
----
Manual Page -- http://www.php.net/manual/en/function.call-user-func-array.php
Edit -- https://master.php.net/note/edit/90112
Del: integrated -- https://master.php.net/note/delete/90112/integrated
Del: useless -- https://master.php.net/note/delete/90112/useless
Del: bad code -- https://master.php.net/note/delete/90112/bad+code
Del: spam -- https://master.php.net/note/delete/90112/spam
Del: non-english -- https://master.php.net/note/delete/90112/non-english
Del: in docs -- https://master.php.net/note/delete/90112/in+docs
Del: other reasons-- https://master.php.net/note/delete/90112
Reject -- https://master.php.net/note/reject/90112
Search -- https://master.php.net/manage/user-notes.php