PHP Sort XML Elements by Date

后端 未结 2 1836
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-20 10:09

Below is my XML file





00/00/0000
My Birthday
         


        
2条回答
  •  失恋的感觉
    2020-12-20 10:42

    You have multiple questions here:

    1. You want to sort a list of SimpleXMLElements. A reference question for that is:
      • PHP sorting issue with simpleXML
    2. You need to append an element-into into a SimpleXMLElement which it does not support by default. This is outlined extensively in:
      • SimpleXML: append one tree to another
      • In SimpleXML, how can I add an existing SimpleXMLElement as a child element?

    Additionally the question about how to search a list of SimpleXMLElements can be further subdivided so your concrete question is not clear. From your question it looks like you've already understood you need to convert the list of SimpleXMLElements into an array.

    So you're probably looking for the reference question how to sort a multidimensional array as well:

    • How do I sort a multidimensional array in php

    As you can see your question has many facets which makes it hard to be answered. Stackoverflow works better if you ask a concrete programming question and not for a full script ;)

提交回复
热议问题