3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = " <div id='div-gpt-ad-1456499310532-2' style='height:90px; width:970px;' style=\"height:90px; width:970px;\"> </div>"; // create a new DomDocument object $doc = new DOMDocument(); // load the HTML into the DomDocument object (this would be your source HTML) $doc->loadHTML($input); removeElementsByTagName('style', $doc); // output cleaned html echo $doc->saveHtml(); function removeElementsByTagName($tagName, $document) { $nodeList = $document->getElementsByTagName($tagName); for ($nodeIdx = $nodeList->length; --$nodeIdx >= 0; ) { $node = $nodeList->item($nodeIdx); $node->parentNode->removeChild($node); } }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: DOMDocument::loadHTML(): Attribute style redefined in Entity, line: 2 in /in/an1lk on line 11 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><div id="div-gpt-ad-1456499310532-2" style="height:90px; width:970px;"> </div></body></html>

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:
51.1 ms | 402 KiB | 8 Q