I want to assign a value to an array element, which is returned by a function with a reference argument. The code:
function f(&$y) {
return $y;
}
$y = '';
$x = array(
'a' => 1,
'b' => 2,
'c' => f($y)
);
var_dump($x); // 'c' is empty
$y = 3;
var_dump($x); // 'c' is still empty
I'm pretty sure I got the whole reference thing all wrong in this case. Still not working even if I try to return by reference like function &f(&y) {}.