Can anyone make a recommendation for sorting a xml tree with a structure as given:
[@attributes] => Array
(
[version] => 4.2.1
)
[action] => getclientsproducts
[result] => success
[clientid] => 000000
[totalresults] => 28
[products] => SimpleXMLElement Object
(
[product] => Array
(
[0] => SimpleXMLElement Object
...
[status] => Active
...
[1] => SimpleXMLElement Object
...
[status] => Cancelled
...
)
)
so i have 28 products inside there (i only showed 2)... the status can be one of six states (active, canceled, pending, terminated, suspended, fraud) ... I'd like to resort the xml order inside [product] such that active items are always first and the rest are last (if I can pass a reference for the sort order for each state that would be ideal but not mandatory)
any suggestions would be appreciated =)