Sort simplexml object - without casting to array
Is it possible to sort a simplexml object but keep the object as a simplexml object instead of casting to an array.
There doesnt appear to be a way to do this - and if casted to an array it seems very messy to transform the array(s) back to a simplexml object.
So -
Is it possible to sort a simplexml object by an attribute etc.
For example (sort by the position attribute node):&l开发者_如何学编程t;test_nodes>
<node position="1"></node>
<node position="2"></node>
<node position="3"></node>
</test_nodes>
If not then what is the most painless and efficient way to cast an array to a simple xml object
精彩评论