Created
September 20, 2011 09:57
-
-
Save daniula/1228771 to your computer and use it in GitHub Desktop.
call_user_func silent error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$var1 = 0; | |
$var2 = 1; | |
function noreference($var1, $var2) { | |
print "noreference\n"; | |
print $var1 + $var2."\n"; | |
} | |
function reference(&$var1, &$var2) { | |
print "reference\n"; | |
print $var1 + $var2."\n"; | |
} | |
call_user_func('noreference', $var1, $var2); | |
call_user_func('reference', $var1, $var2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
According to this: http://php.net/manual/en/function.call-user-func.php and "Note that the parameters for call_user_func() are not passed by reference." you have to do this that way: