altergothen Posted October 20, 2006 Share Posted October 20, 2006 I want to be able to echo array items within an array within an arrayHere is my array structure:Please help!Thanks.Array( [inside_image] => [items] => Array ( [0] => Array ( [title] => Bangladesh's Health Nutrition Program Gets 460 Mln USD (RedNova) [link] => http://us.rd.yahoo.com/dailynews/rss/search/health+nutrition. [description] => 10/19/2006 - European food companies are already being asked to ... ) [1] => Array ( [title] => Member States start compiling health claims lists (Nutraingredients.com) [link] => http://us.rd.yahoo.com/dailynews/rss/search/health+nutrition/SIG=12o66dneo [description] => 10/19/2006 - European food companies are already being asked to ... ) [2] => Array ( [title] => Good nutrition essential for bone health (Antara News) [link] => http://us.rd.yahoo.com/dailynews/rss/search/health+nutrition/SIG=11f9hhq9g [description] => (Full text of a statement. Contact details below.) )) [channel] => Array ( [title] => Yahoo! News Search Results for health nutrition )) Link to comment https://forums.phpfreaks.com/topic/24534-arrays-within-arrays-within-arrays/ Share on other sites More sharing options...
printf Posted October 20, 2006 Share Posted October 20, 2006 The easy part is walking the array, the hard part is knowing the format you need the results returned in! Left me explain that. The only time you really need to walk through an array is when you need to do something to the complete array, like remove slashes or set some elements that may have a certain value or maybe empty. In this case it's different, because you need to format the output as your running through the array. To do that, one needs to know how you want to format the output.me! Link to comment https://forums.phpfreaks.com/topic/24534-arrays-within-arrays-within-arrays/#findComment-111785 Share on other sites More sharing options...
Ferenc Posted October 20, 2006 Share Posted October 20, 2006 <?php echo $array_name['items']['0']['title'];echo $array_name['items']['0']['link'];echo $array_name['items']['0']['description'];?>If you need to show each item you will needd to create a loop of some sort Link to comment https://forums.phpfreaks.com/topic/24534-arrays-within-arrays-within-arrays/#findComment-111789 Share on other sites More sharing options...
altergothen Posted October 20, 2006 Author Share Posted October 20, 2006 Thanks a million Guys!printf - please can you give me a formatted example?thanks Link to comment https://forums.phpfreaks.com/topic/24534-arrays-within-arrays-within-arrays/#findComment-111791 Share on other sites More sharing options...
altergothen Posted October 20, 2006 Author Share Posted October 20, 2006 I think i figured it out? ..... Correct?>>>$title = $rss_array['items']['0']['title'];$link = $rss_array['items']['0']['link'];$description = $rss_array['items']['0']['description'];echo "<p class='heading'><a href='$link'>$title</a></p><p class='text'>$description</p><a href='$link'>Read Full Article ...</a> ";?> Link to comment https://forums.phpfreaks.com/topic/24534-arrays-within-arrays-within-arrays/#findComment-111792 Share on other sites More sharing options...
Orio Posted October 20, 2006 Share Posted October 20, 2006 Yeah :)Orio. Link to comment https://forums.phpfreaks.com/topic/24534-arrays-within-arrays-within-arrays/#findComment-111794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.