Having an array $a and a key $key, it's usually as simple as $a[$key] to get the value for that key in the array. However, if the array is returned by a function like this:
function getArray(){
return array('a' => someObjectValue1, 'b' => someObjectValue2);
}
echo getArray()['a'];
, then you can't simply do getArray()[$key] as in some versions of PHP this would give you
Parse error: syntax error, unexpected '[', expecting ',' or ';'
Then ofcourse something like this would work:
$a = getArray();
echo $a['a'];
but I'm in the Watch window of XDebug and I can't do that.
Any ideas? Thanks.