3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = <<<EOT <html> <body> <img src="img1.jpg" /> <img src="img2.jpg" /> <a href="#"> link 1</a> <a href="page.HTML">link 2</a> </body> </html> EOT; $d = new DOMDocument(); $d->loadHTML($str); $sx = simplexml_import_dom($d); foreach ($sx->xpath('') as $v) { echo $v->getName() . "\n"; }
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.2.6
Warning: SimpleXMLElement::xpath(): Invalid expression in /in/jdcs8 on line 20 Warning: SimpleXMLElement::xpath(): xmlXPathEval: evaluation failed in /in/jdcs8 on line 20 Warning: Invalid argument supplied for foreach() in /in/jdcs8 on line 20
Output for hhvm-3.15.4
Warning: Invalid argument supplied for foreach() in /in/jdcs8 on line 22 XPath error : Invalid expression xmlXPathEval: evaluation failed