3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<'HTML' <div id='makeme' class='testme'> <span id='whatspanID'>somthing</span> <p class='ptagclass'></p> </div> HTML; $dom = new DOMDocument(); $dom->loadHtml($html); $xpath = new DOMXpath($dom); $div = $xpath->evaluate('//div[@id="makeme"]')->item(0); $nodes = $xpath->evaluate('.//text()|.//@*', $div); foreach ($nodes as $node) { $node->parentNode->removeChild($node); } echo $dom->saveHtml($div);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught DOMException: Not Found Error in /in/jhv2e:17 Stack trace: #0 /in/jhv2e(17): DOMNode->removeChild(Object(DOMAttr)) #1 {main} thrown in /in/jhv2e on line 17
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
48.38 ms | 401 KiB | 8 Q