View Single Post
Old 07-07-2010, 06:46 PM   #2 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

There are lots of different ways to do this: here are three ideas.
  1. Use XSL to transform the XML document into one which has the items sorted as you want. This has the advantage of simplicity since your PHP will just see the new, sorted XML and doesn't have to do anything special.
  2. Simply push the elements that you want sorted to an array, then sort that array; perhaps with uasort.
  3. Essentially do the same as #2 but in an object-oriented manner with something like an ArrayObject from the Standard PHP Library.
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
webosb (07-07-2010)