3v4l.org

run code in 300+ PHP versions simultaneously
<?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.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
PASS
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.3.11, 4.4.0 - 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

preferences:
268.99 ms | 401 KiB | 461 Q