3v4l.org

run code in 300+ PHP versions simultaneously
<?php libxml_use_internal_errors(true); $dom = new DOMDocument; $dom->loadHTML('<h1>junk</h1><div>wth?</div>ANYTHING HERE<div class="col"></div>'); $xpath = new DOMXPath($dom); $found = $xpath->query('//div[@class="col"]/preceding-sibling::text()'); if ($found instanceOf DOMNodeList && $found->length > 0) { $text = $found->item(0); $comment = $dom->createComment(''); $text->parentNode->replaceChild($comment, $text); } echo $dom->saveXML($dom->getElementsByTagname('body')->item(0));
Output for git.master, git.master_jit, rfc.property-hooks
<body><h1>junk</h1><div>wth?</div><!----><div class="col"/></body>

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:
52.89 ms | 401 KiB | 8 Q