Having an issue parsing some XML from within PHP. A node contains a node value and other nodes. Is there a way to parse both?
I am consuming this via an API so cannot control the output.
<?php
$xml = '<root>
<foo>
bar
<foobar>Foobar</foobar>
</foo>
</root>';
$data = new \SimpleXMLElement($xml);
var_dump($data);
Will output:
object(SimpleXMLElement)#3 (1) {
["foo"]=>
string(11) "bar"
}