3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $root = new DOMDocument(); $root->loadXML('<article id=""></article>'); for($i=0;$i<=300;$i++){ $node = new DOMDocument(); $node->loadXML('<section id="'.$i.'"><h1>Überschrift</h1><h2>Überschrift2</h2><p>Content</p></section>'); $xpath = new DOMXPath($node); $query = '//h1'; print_r($xpath->query($query)); $node = $root->importNode($node->documentElement, true); $root->documentElement->appendChild($node); } #print $root->saveXML();
based on Cr2ND
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 ) DOMNodeList Object ( [length] => 1 )