3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <div> <span class="hello"></span> <span class="somethingElse"></span> <div> <span class="hello"></span> <span class="nestedSomethingElse"></span> </div> </div> HTML; $doc = new DomDocument; $doc->loadXML($html); $xpath = new DOMXPath($doc); $elements = $xpath->query('//span[@class="hello"]'); foreach ($elements as $el) { $el->parentNode->removeChild($el); } echo $doc->saveXML();
Output for git.master, git.master_jit, rfc.property-hooks
<?xml version="1.0"?> <div> <span class="somethingElse"/> <div> <span class="nestedSomethingElse"/> </div> </div>

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:
190.2 ms | 405 KiB | 5 Q