Jump to content

Sort XML elements by Date Element?


noahssite

Recommended Posts

Hello I am using a DOMDocument to retrieve information from an XML file. The information is setup like so:

 

<person>
<name>John Smith</name>
<born>March 15th, 1987</born>
</person>
<person>
<name>Eric Lee</name>
<born>July 18th, 1949</born>
</person>
<person>
<name>Michael Arnold</name>
<born>April 2nd, 2003</born>
</person>

 

At the moment I am displaying just the names of each of these groups on the page. How would I display the names of each of these people according to when they were born? (Youngest to oldest or oldest to youngest)

 

I believe it has something to do with strtotime() and sort() but can someone explain or give an example?

Link to comment
https://forums.phpfreaks.com/topic/227546-sort-xml-elements-by-date-element/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.