Skip to content

Instantly share code, notes, and snippets.

@lolautruche
Created August 28, 2015 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lolautruche/4caf81d231f5ebfc9446 to your computer and use it in GitHub Desktop.
Save lolautruche/4caf81d231f5ebfc9446 to your computer and use it in GitHub Desktop.
<?php
$foo = function (&$arg) {
var_dump($arg);
};
$a = 'bar';
$b =& $a;
// Warning: Parameter 1 to {closure}() expected to be a reference, value given in /Users/lolautruche/Desktop/reference.php on line 8
call_user_func_array($foo, [$b]);
// Works fine
call_user_func_array($foo, [&$a]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment