3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = <<<XML <?xml version="1.0" ?> <root> <child> <grandchild/> </child> <child> <grandchild/> </child> </root> XML; $doc = new DOMDocument; $doc->loadXML($xml); $xpath = new DOMXPath($doc); foreach ($xpath->query('./*', $doc->documentElement) as $el) { echo $el->tagName . "\n"; }
based on dNTGf
Output for 5.6.0 - 7.3.0alpha1
child child