Not really. You could define a function to do it, though:
function array_value($array, $key) {
return $array[$key];
}
// and then
echo array_value(getData($id), 'name');
The only other way, which probably won't help you much in this case, is to use list()
which will get you the first n
items in the returned array. You have to know the order of the items in the list beforehand, though:
function test() {
return array(1, 2, 3, 4);
}
list($one, $two, $three) = test();
// now $one is 1, $two is 2, $three is 3