3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $body = "&nbps; &#8820; <h1>h1</h1> Paragraph <a href=\"http://google.com/\">link</a> <strong>Bold</strong> <em>italic</em> <em><strong>bolditalic</strong></em>&nbsp;<span style=\"background-color: #ffff00; \"></span> <h2>h2</h2> Paragraph <span style=\"font-size: xx-small;\">size1</span> <span style=\"font-size: x-small;\">size2</span> <span style=\"font-size: medium;\">size4</span> <h3>h3</h3> Paragraph <span style=\"text-decoration: underline;\">underline</span> <span style=\"text-decoration: line-through;\">strikethrough</span> <span style=\"color: #ff0000;\">color</span> <span style=\"background-color: #ffff00; \">background</span> <blockquote>Blockquoted paragraph</blockquote> Paragraph following blockquote <ul> <li>Unordered</li> <li>List</li> </ul> Paragraph between lists <ol> <li>Ordered</li> <li>List</li> </ol> Paragraph between lists <ul> <li>OL list</li> <li>nested <ol> <li>inside a</li> <li>UL list</li> </ol></li> </ul> Paragraph between lists <table border=\"0\"> <tbody> <tr> </tr> <tr> <td>Table with</td> <td></td> </tr> <tr> <td></td> <td>border=0</td> </tr> </tbody> </table> Paragraph <ol> <li>UL list</li> <li>nested <ul> <li>inside a</li> <li>OL list</li> </ul> </li> </ol> Paragraph between tables <table border=\"1\" cellpadding=\"5\"> <tbody> <tr> <td>Table with border=1</td> <td></td> </tr> <tr> <td></td> <td>cellpadding = 5</td> </tr> </tbody> </table> Paragraph between tables <table border=\"2\"> <tbody> <tr> <td>Table with</td> <td></td> </tr> <tr> <td></td> <td>border=2</td> </tr> </tbody> </table>"; $html = "<html><meta http-equiv='content-type' content='text/html; charset=UTF-8'><body>$body</body></html>"; $doc = new DOMDocument(); libxml_use_internal_errors(true); $doc->loadHTML($html); $xpath = new DOMXPath($doc); $nodeList = $xpath->query('//body[1]'); echo ((get_class($nodeList->item(0)) == 'DOMElement') ? 'PASS' : 'FAIL');
Output for 5.1.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
PASS
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function libxml_use_internal_errors() in /in/XUin1 on line 85
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/XUin1 on line 84
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/XUin1 on line 84