3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <a href="http://aaa.com">http://aaa.com</a> HTML; $dom = new DOMDocument(); $dom->loadHTML($html); foreach ($dom->getElementsByTagName('a') as $link) { var_dump($link->getAttribute('href')); }

preferences:
35.25 ms | 402 KiB | 5 Q