I'm trying to find a value in a nested JSON using PHP. I've done a print_r()
of it and get:
Array
(
[types] => Array
(
[0] => Array
(
[name] => Running
[arabicName] => الجاري
[categories] => Array
(
[0] => Array
(
[name] => Entertainment
[arabicName] => تسلية
[programs] => Array
(
[0] => Array
(
[id] => 375
[name] => Saalo Marteh
[arabicName] =>
[image] => http://plus.mtv.com.lb/Chrome/KPanel/Pictures/Programs/151120100928327.jpg
)
[1] => Array
(
[id] => 491
[name] => Celebrity Duets
[arabicName] =>
[image] => http://plus.mtv.com.lb/Chrome/KPanel/Pictures/Programs/151108084429774.jpg
)
I'm trying to get the value for name
and id
under the entertainment header.
I've tried the following but no luck:
echo $json['types']['categories'][0]['name'];