SimpleXMLElement Object ([date] = = Array ([0] = Friday (today, Real time: +) [1] = Saturday [2] = Sunday [3] = Monday) [Daypictureurl] = = Array ([0] = = Http://api. map.baidu.com/images/weather/day/qing.png [1] = Http://api.map.baidu.com/images/weather/day/qing.png [2] = http://api.map.baidu.com/images/weather/day/qing.png [3] = http://api.map.baidu.com/images/w Eather/day/duoyun.png) [Nightpictureurl] = = Array ([0] = Http://api.map.baidu.com/ima ges/weather/night/qing.png [1] = http://api.map.baidu.com/images/weather/night/qing.png [2] => ; http://api.map.baidu.com/images/weather/night/duoyun.png [3] = Http://api.map.baidu.com/images/weather/nigh t/duoyun.png) [Weather] = Array ([0] = clear [1] = clear [2] = = Sunny Turn cloudy [3] => Cloudy) [wind] = = Array ([0] = North 3-4 [1] = South Wind Breeze [2] = = Southerly breeze [3] = South wind Breeze) [temperature] = = Array ([0] = 24 ~ 9 [1] [2] = ~ [3] = 22 ~ 11)
How to loop such XML data into an array of arrays (' date ' = ' = ', ' daypictureurl ' = ' ', ' nightpictureurl ' = ' = ', ' weather '));
Reply to discussion (solution)
foreach ($xml->date as $i = + $v) { $res [] = Array ( ' date ' = = $v, ' daypictureurl ' + $xml daypictureurl[$i], ' nightpictureurl ' = $xml->nightpictureurl[$i], ' weather ' = $XM->weather[$ I], );} Print_r ($res);
Format SimpleXMLElement object? (array) SimpleXMLElement Object
Thanks for all your help.