keeps21 Posted June 8, 2009 Share Posted June 8, 2009 I have an array which I want to sort by the index 'pubDate' from most recent to oldest But I'm not sure how to do it. Here is the array I'm working with Array ( [0] => Array ( [title] => SimpleXMLElement Object ( [0] => Warriors net two more signings ) [pubDate] => SimpleXMLElement Object ( [0] => Mon, 08 Jun 2009 10:10:15 GMT ) [description] => SimpleXMLElement Object ( ) [link] => SimpleXMLElement Object ( [0] => http://www.whitleywarriors.net/news/view/id/202/warriors-net-two-more-signings.html ) ) [1] => Array ( [title] => SimpleXMLElement Object ( [0] => New Website Launched ) [pubDate] => SimpleXMLElement Object ( [0] => Mon, 01 Jun 2009 11:16:50 GMT ) [description] => SimpleXMLElement Object ( ) [link] => SimpleXMLElement Object ( [0] => http://www.whitleywarriors.net/news/view/id/200/new-website-launched.html ) ) [2] => Array ( [title] => SimpleXMLElement Object ( [0] => Warrior Spike ) [pubDate] => SimpleXMLElement Object ( [0] => Wed, 27 May 2009 22:17:08 GMT ) [description] => SimpleXMLElement Object ( ) [link] => SimpleXMLElement Object ( [0] => http://www.whitleywarriors.net/news/view/id/199/warrior-spike.html ) ) [3] => Array ( [title] => SimpleXMLElement Object ( [0] => Legends return to the ice ) [pubDate] => SimpleXMLElement Object ( [0] => Wed, 27 May 2009 22:16:15 GMT ) [description] => SimpleXMLElement Object ( ) [link] => SimpleXMLElement Object ( [0] => http://www.whitleywarriors.net/news/view/id/198/legends-return-to-the-ice.html ) ) [4] => Array ( [title] => SimpleXMLElement Object ( [0] => Captain Dunn - Sample and Wilson to return ) [pubDate] => SimpleXMLElement Object ( [0] => Thu, 21 May 2009 10:46:56 GMT ) [description] => SimpleXMLElement Object ( ) [link] => SimpleXMLElement Object ( [0] => http://www.whitleywarriors.net/news/view/id/192/captain-dunn--sample-and-wilson-to-return.html ) ) [5] => Array ( [title] => SimpleXMLElement Object ( [0] => Two in, one out ) [pubDate] => SimpleXMLElement Object ( [0] => Sat, 16 May 2009 14:05:23 GMT ) [description] => SimpleXMLElement Object ( ) [link] => SimpleXMLElement Object ( [0] => http://www.whitleywarriors.net/news/view/id/180/two-in-one-out.html ) ) ) How would I do this? Quote Link to comment https://forums.phpfreaks.com/topic/161394-solved-sorting-an-array/ Share on other sites More sharing options...
947740 Posted June 8, 2009 Share Posted June 8, 2009 Is there any way for you to simply sort the data before you create the array? Quote Link to comment https://forums.phpfreaks.com/topic/161394-solved-sorting-an-array/#findComment-851836 Share on other sites More sharing options...
keeps21 Posted June 8, 2009 Author Share Posted June 8, 2009 I don't think so. What I'm wanting to do is merge a number of feeds together, and output the latest x items ordered by date, most recent first. I'll be taking a feed, reading the feed data into the array, and then repeating for a number of feeds. I then want to sort the order of the array. Quote Link to comment https://forums.phpfreaks.com/topic/161394-solved-sorting-an-array/#findComment-851911 Share on other sites More sharing options...
.josh Posted June 8, 2009 Share Posted June 8, 2009 array_multisort Quote Link to comment https://forums.phpfreaks.com/topic/161394-solved-sorting-an-array/#findComment-851964 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.