php - How would I go about traversing this JSON object? -


how access [0] -> array() located below , retrieve [title] "spirited away" iterating on array?

array (      [@attributes] => array     (         [version] => 2.0     )  [channel] => array     (         [title] => site title         [link] => site/         [language] => en-us         [category] =>         [image] => array             (                 [title] => site                 [url] => http://example.com                 [link] => example.com             )          [item] => array             (                 [0] => array                     (                         [title] => spirited away                         [pubdate] => date                         [category] => movies                         [link] => linkhere                         [enclosure] => array                             (                                 [@attributes] => array                                     (                                         [url] => someurlhere                                         [length] => length                                         [type] => application/x-bittorrent                                     )                              ) 

i'm trying iterate on array using foreach loop it's outputting nothing. post code code section of question long. i'm using php , nothing have tried far working.

this json code generated xml document using json_encode , decoded using json_decode json object.

comment answer correct.

to loop through particular array structure its:

foreach ( $array['channel']['item'] $x){     echo $x['title']; } 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -