3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = <<< HTML <a>some stuff we don not want</a> <table cellpadding="2" cellspacing="1" bgcolor="#A0A0A0"> </table> <table id="anothertable"> </table> HTML; $dom = new DOMDocument(); $dom->loadHTML($input); foreach ($dom->getElementsByTagName('table') as $element) { var_dump($element); }

preferences:
38.93 ms | 402 KiB | 5 Q