Help parsing an Array

Hello,

The following array is from a Yahoo Weather RSS feed using a script from here. It returns today’s weather, tomorrow’s weather and the day after.

	[condition] => Array ( 
		[text] => SimpleXMLElement Object ( [0] => Partly Cloudy )
		

=> SimpleXMLElement Object ( [0] => 30 )
[temp] => SimpleXMLElement Object ( [0] => 79 )
[date] => SimpleXMLElement Object ( [0] => Sun, 06 Jul 2008 9:54 am EDT )
)

[forecast] => Array ( 
	[Mon] => Array ( 
		[day] => SimpleXMLElement Object ( [0] => Mon )
		[date] => SimpleXMLElement Object ( [0] => 7 Jul 2008 )
		[low] => SimpleXMLElement Object ( [0] => 69 )
		[high] => SimpleXMLElement Object ( [0] => 87 )
		[text] => SimpleXMLElement Object ( [0] => Isolated Thunderstorms )
 => SimpleXMLElement Object ( [0] => 37 )
		)

		[Tue] => Array ( 
			[day] => SimpleXMLElement Object ( [0] => Tue )
			[date] => SimpleXMLElement Object ( [0] => 8 Jul 2008 )
			[low] => SimpleXMLElement Object ( [0] => 71 )
			[high] => SimpleXMLElement Object ( [0] => 90 )
			[text] => SimpleXMLElement Object ( [0] => Sunny )
			

=> SimpleXMLElement Object ( [0] => 37 )
)
)
)




How do I parse through the array and echo out:


Day: Today
Weather: Partly Cloudy

Day: Mon
Weather: Isolated Thunderstorms

Day: Tue
Weather: Sunny



Many thanks.

Just what I needed. Thank you very much, kind sir. :slight_smile:

I would do something simple like

echo 'Day: Today<br />';
echo 'Weather: '.$yw_forecast['condition']['text'];

foreach($yw_forecast['forecast'] as $forecast){
    echo '<br /><br />';
    echo 'Day: '.$forecast['day'].'<br />';
    echo 'Weather: '.$forecast['text'];
}