In this shortened example:
print_r($foo);
Array
(
[0] => Array
(
[function] => exception_handler
[class] => LP
[type] => ::
[args] => Array
(
[0] => Exception Object
(
[trace:Exception:private] => Array
(
[0] => Array
(
[args] => Array
(
[0] => 'hello'
[1] => 'world'
)
)
)
)
)
)
)
How do I access the last item which is “hello”.
I am lost after $foo[0]['args'][0]
It’s an object of type
Exceptionand the values are within a (private) property namedtrace, thus I guess it’sException::getTrace()… Just realize: You said “last item”, but also you said “hello”, so know I don’t know, what you want. However,
$trace[0]['args']is a regular array and you should be able do with it, whatever you like 🙂end()gives you the last item.