I am having a little trouble with an xml feed (atom). I am running a for each loop to return prices using simple xml and converting them too arrays which works fine below :-
foreach ($dc->departures->departure as $price)
{
$lowest = $price->prices->price[5]->asXML();
$lowestval = array($lowest);
print_r($lowestval);
}
Which is returning :-
Array ( [0] => 2289 )
Array ( [0] => 2207 )
Array ( [0] => 2369 )
Array ( [0] => 2229 )
My goal is to return only the lowest price, so I can display a Prices From: area. From what I understand I need to use the min()
function, however this only works with one array with several values. I've tried array_merge which doesn't seem to work and just returns the same as above. I am a PHP newbie so there maybe something obvious. A kick in the correct direction would be appreciated.