Possible Duplicate:
PHP syntax for dereferencing function result
The use of $tmp
below is pretty ugly. Is there a way to avoid it?
function test()
{
return array('a'=>1, 'b'=>2);
}
$tmp = test();
echo "This should be 2: ", $tmp['b'], "\n";
Is there some reason the natural
test()['b']
doesn't work?