Sort XML output PHP



I have this XML link XML OUTPUT. What i want is to sort the output on the key pubDate . I allready put the output in a PHP array with this code:



$xml = simplexml_load_file($url);
$xml_array = (array) $xml;


But for now i want to sort the array on the pubDate, how can i do that? Output the newest first.


This is the VAR_DUMP



Array


( [@attributes] => Array ( [version] => 2.0 )



[channel] => SimpleXMLElement Object
(
[title] => Marktplaats.nl - Gevonden resultaten met de zoekterm 'volkswagen or nissan or audi or seat or kia or toyota or peugeot or volvo or bmw or chrysler or mini or citroen or hyundai or mercedes or mazda or alfa or jeep or daewoo or honda or jaguar or mitsubishi or rover or saab or skoda or suzuki or smart'
[link] => http://ift.tt/L0lkBp
[description] => Marktplaats.nl - Gevonden resultaten met de zoekterm 'volkswagen or nissan or audi or seat or kia or toyota or peugeot or volvo or bmw or chrysler or mini or citroen or hyundai or mercedes or mazda or alfa or jeep or daewoo or honda or jaguar or mitsubishi or rover or saab or skoda or suzuki or smart'. Kopen en verkopen van tweedehands of nieuwe producten en van diensten doet u op Marktplaats.nl, de advertentiesite van Nederland. Marktplaats.nl is een compleet overzicht van vraag en aanbod.
[language] => nl
[copyright] => Copyright (C) 1999-2015 Marktplaats.nl. Alle rechten voorbehouden.
[image] => SimpleXMLElement Object
(
[title] => Marktplaats.nl
[link] => http://ift.tt/L0lkBp
[url] => //statisch.marktplaats.com/images/logo.gif
)

[item] => Array
(
[0] => SimpleXMLElement Object
(
[title] => SimpleXMLElement Object
(
)

[link] => http://ift.tt/1LPQxk1
[description] => SimpleXMLElement Object
(
)

[pubDate] => vr, 27 feb 2015 12:14:30
)

[1] => SimpleXMLElement Object
(
[title] => SimpleXMLElement Object
(
)

[link] => http://ift.tt/1BFYrgj
[description] => SimpleXMLElement Object
(
)

[pubDate] => vr, 27 feb 2015 11:48:45
)

[2] => SimpleXMLElement Object
(
[title] => SimpleXMLElement Object
(
)

[link] => http://ift.tt/1BFYpVC
[description] => SimpleXMLElement Object
(
)

[pubDate] => zo, 22 feb 2015 07:32:09
)

No comments:

Post a Comment