Hello there everyone.
Some recent code I've been working on connects to an online web service. This code (after using json_decode($events, true)) displays the following:
Code:
Array
(
[0] => Array
(
[0] => connected
)
[1] => Array
(
[0] => typing
)
[2] => Array
(
[0] => gotMessage
[1] => Hello!
)
[3] => Array
(
[0] => typing
)
[4] => Array
(
[0] => stoppedTyping
)
)
My question is, how would I go about accessing this data, seeing as it's a bunch of arrays inside of an array?
I understand the basics of accessing arrays in the method of $array_name[number] and $array_name['identifier'].
Lets assume the array code I posted above was the variable $events. If I do
Code:
print_r($events[4]);
That does not return the desired result (often outputting nothing at all). What am I doing wrong here? Can anyone set me on the right track?
Thank you in advance for your time & help.
|