3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php <?php $html = <<<HTML <div> <div> <p> ... </p> </div> </div> HTML; $dom = new DOMDocument; $dom->loadHTML($html); $xpath = new DOMXPath($dom); $nodes = $xpath->query('//*'); foreach ($nodes as $node) { printf( "Nodes in List: %d \n" . "Current Tag: %s \n" . "Current Parent: %s \n\n", $nodes->length, $node->tagName, $node->parentNode->tagName ); $node->parentNode->removeChild($node); } echo $dom->saveHtml();
Output for 5.3.0 - 5.4.16
Parse error: syntax error, unexpected '<' in /in/91IcK on line 2
Process exited with code 255.