3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<'HTML' <!DOCTYPE html><html><body> <small>0</small> <small>1</small> <small>2</small> <small>3</small> </body></html> HTML; $dom = new DOMDocument; $dom->loadHTML($html); $nodeArray = iterator_to_array($dom->getElementsByTagName('small')); foreach($nodeArray as $node) { $node->parentNode->removeChild($node); } echo $dom->saveHTML();

preferences:
25.03 ms | 404 KiB | 5 Q