3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <?xml version="1.0"?> <a> <b> <c> <value>Some Value</value> </c> </b> </a> XML; $a = new SimpleXMLElement($xml); $nodes = $a->xpath('/a/b/c/value'); $node = $nodes[0]; if ($node) { echo "Node\n"; } foreach ($a->b->c->children() as $key => $value) { if ($value) { echo "VALUE\n"; } var_dump($value); }

preferences:
43 ms | 402 KiB | 5 Q