3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $html = '<h1>Foo</h1><h2>Bar</h2><p>lorem ipsum</p>'; $dom = new \DomDocument(); $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED); $nodes = $dom->getElementsByTagName('*'); echo $nodes->item(0)->tagName . ' -> ' . $nodes->item(0)->nodeValue . "\n"; foreach ($nodes as $node) { echo $node->tagName . ' -> ' . $node->nodeValue . "\n"; }
Output for 5.4.0 - 7.2.0
h1 -> FooBarlorem ipsum h1 -> FooBarlorem ipsum h2 -> Bar p -> lorem ipsum
Output for 5.3.0 - 5.3.29
Notice: Use of undefined constant LIBXML_HTML_NOIMPLIED - assumed 'LIBXML_HTML_NOIMPLIED' in /in/SFlNo on line 5 Warning: DOMDocument::loadHTML() expects exactly 1 parameter, 2 given in /in/SFlNo on line 5 Notice: Trying to get property of non-object in /in/SFlNo on line 7 Notice: Trying to get property of non-object in /in/SFlNo on line 7 ->
Output for 5.0.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/SFlNo on line 4 Notice: Use of undefined constant LIBXML_HTML_NOIMPLIED - assumed 'LIBXML_HTML_NOIMPLIED' in /in/SFlNo on line 5 Warning: DOMDocument::loadHTML() expects exactly 1 parameter, 2 given in /in/SFlNo on line 5 Notice: Trying to get property of non-object in /in/SFlNo on line 7 Notice: Trying to get property of non-object in /in/SFlNo on line 7 ->
Output for 4.4.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/SFlNo on line 4 Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/SFlNo on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/SFlNo on line 4 Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/SFlNo on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/SFlNo on line 4 Parse error: parse error, expecting `','' or `';'' in /in/SFlNo on line 7
Process exited with code 255.