/me is now completely confused...
function foo(&$var)
{
$var++;
}
$a=5;
foo($a);
works.
function foo(&$var)
{
$var++;
}
$a=5;
call_user_func_array('foo', array($a));
But if I understood correctly (even though it may not be the case at that point) if it is changed to:
function foo($var)
{
$var++;
}
$a=5;
call_user_func_array('foo', array(&$a));
it should raise the:
Did I miss anything?
So:
function foo($var)
{
$var++;
}
$a=5;
call_user_func_array('foo', array(&$a));
is fine and
function foo($var)
{
$var++;
}
$a=5;
call_user_func_array('foo', &$a);
is broken?...and what's the difference in practical terms?
What's the most appropriate approach?
The correct approach is that the receiving function should always indicate its requiring a reference, making the whole thing moot.
Also, the difference between using array(&$a) and &$a is quite important - &$a then needs to contain all the parameters you're sending, rather than being able to send multiple things through in a nicely delineated fashion.