I'm working on a program that uses PHP's internal array pointers to iterate along a multidimensional array. I need to get an element from the current row, and I've been doing it like so:
$arr[key($arr)]['item']
However, I'd much prefer to use something like:
current($arr)['item'] // invalid syntax
I'm hoping there's a function out there that I've missed in my scan of the documentation that would enable me to access the element like so:
getvalue(current($arr), 'item')
or
current($arr)->getvalue('item')
Any suggestions?
getvalueapproach would be useful even of single-dimmensional arrays too. It would allow to workaroung the ≤5.3 syntax limitations and allowing to access an element from an array, say returned by a function call, directly within one statement. I’m missing such internal function.