3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<EOT <div> <p>Hello World</p> <!-- <table class="123456789132456789123456789123456789123456789"> <tr class=""> <!--<td></td>--> <!--<td></td>--> <td class="123456789123456789123456789123456789123456789">FooBar</td> </tr> </table> --> </div> EOT; do { $html = preg_replace("/<!--(?(?!<!--).)*-->/sU", '', $html, -1, $count); } while ($count); echo $html;

preferences:
27.64 ms | 404 KiB | 5 Q