I saw some function declarations like this:
function boo(&$var){
...
}
what does the &
character do?
I saw some function declarations like this:
function boo(&$var){
...
}
what does the &
character do?
It's a pass by reference. The variable inside the function "points" to the same data as the variable from the calling context.
function foo(&$bar)
{
$bar = 1;
}
$x = 0;
foo($x);
echo $x; // 1