This one is stumping me. I'm trying to figure out why this doesn't work. I have a function that returns an array. I want to use list to put that array into variables. It doesn't seem to be working. Here is what I have:
function($x, $y, $z){
return array('x' => $x, 'y' => $y, 'z' => $z);
}
list($x, $y, $z) = function($x, $y, $z);
That however does not seem to return variables back into the $x, $y, $z variables.
Instead I have to do this:
function($x, $y, $z){
return array('x' => $x, 'y' => $y, 'z' => $z);
}
$array = function($x, $y, $z);
$x = $array['x'];
$y = $array['y'];
$z = $array['z'];
Anything I am doing wrong in this particular case? Is there some kind of limitation to the list function that would prevent this from working? (Note, above is obviously not a real function or defined correctly and is only presented as an example).