3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = <<<HTML <!doctype html> <html> <body> text to keep <span xxx="xxxx"><span xxx="xxx">unwanted text</span> unwanted text </span> text to keep </body> </html> HTML; $doc = new DOMDocument(); $doc->loadHTML($str); $xpath = new DOMXPath($doc); foreach($xpath->evaluate("//span") as $node) { echo 'Removing: '.$node->nodeValue."<br>"; $node->parentNode->removeChild($node); } $output = $doc->saveHTML(); echo htmlspecialchars($output);
Output for git.master, git.master_jit, rfc.property-hooks
Removing: unwanted text unwanted text <br>Removing: unwanted text<br>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;body&gt; text to keep text to keep &lt;/body&gt; &lt;/html&gt;

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