I need help traversing an array within array, I only need to loop through certain arrays, for example, how would I just lop through the names array?
Array
(
[@total_records] => 10
[@total_matching_records] => 10
[@available_records] => 200
[@available_matching_records] => 12
[query] => Array
(
[summary] => Array
(
[emails] => Array
(
[0] => Array
(
[content] => [email protected]
)
)
)
)
[results] => Array
(
[person] => Array
(
[@match_score] => 1
[summary] => Array
(
[names] => Array
(
[0] => Array
(
[first] => Jonathan
[last] => Lyon
[display] => Jonathan Lyon
)
[1] => Array
(
[first] => Jonathan
[last] => Jordan
[display] => Jonathan Jordan
)
)
I have tried this but can't get it to work:-
foreach($json_output['results']['person']['summary']['names'] as $key => $val) {
echo $key.": ".$val."</br>";
}
Any help would be greatly appreciated.
Thanks
Jonathan