Background
In every other programming language I use on a regular basis, it is simple to operate on the return value of a function without declaring
my usual workaround is to have a generic function like this
function e($a, $key, $def = null) { return isset($a[$key]) ? $a[$key] : $def; }
and then
echo e(someFunc(), 'key');
as a bonus, this also avoids 'undefined index' warning when you don't need it.
As to reasons why foo()[x]
doesn't work, the answer is quite impolite and isn't going to be published here. ;)