Hello have worten some php code to parse a xml file as long if i use seperate fields this works like a charm but how i can call a subtree ?
like eg :
<item>
  <items>
    <date>
      <from>2020-03-23</from>
      <until>2020-03-27</until>
    </date>
  </items>
</item>
```
Advertisement
Answer
I assume with subtree you mean an element within an element etc.
PHP offers a built in solution for this: simplexml_load_string
$xml = <<<BLOCK
<item>
  <items>
    <date>
      <from>2020-03-23</from>
      <until>2020-03-27</until>
    </date>
  </items>
</item>
BLOCK;
var_dump(simplexml_load_string($xml));
You can read a file directly aswell by using simplexml_load_file.