3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $html = '<h2>Bar</h2><p>lorem ipsum</p>'; $dom = new \DomDocument(); $dom->loadHTML( $html, LIBXML_HTML_NODEFDTD ); $html = ''; foreach( $dom->getElementsByTagName('body')[0]->childNodes as $node ) { $html .= $dom->saveHTML( $node ); } var_dump( $html );
based on 7CKrp
Output for 5.6.3 - 7.2.0
string(31) "<h2>Bar</h2> <p>lorem ipsum</p>"
Output for 5.4.0 - 5.6.2
Fatal error: Cannot use object of type DOMNodeList as array in /in/ZILf1 on line 7
Process exited with code 255.