i have a function that returns an array with keys and values, like this
function someinfo($x, $y){
//something done by the function
//the array will be like
$info=array(
"name" => "aaa",
"email" => "[email protected]"
);
return $info;
}
i can do this
$returned_info=someinfo(1,2);
print $returned_info['name'];
but i want something in one line of code, like:
print $someinfo(1,2)['name'];
how can i print the values from the returned array in one single line?
thanks, have a nice day
print $someinfo(1,2)['name'];available sincephp5.4. On older version useprint $returned_info['name'];Function array dereferencing has been added, e.g. foo()[0].ch1.php.net/manual/en/migration54.new-features.php