开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜