3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dom = new DOMDocument; $content = 'aasdfasdfa <br>'; $div = $dom->createElement( 'div'); // No $contents here $fragment = $dom->createDocumentFragment(); $fragment->appendXML( $content); $div->appendChild( $fragment); $dom->appendChild( $div); echo $dom->saveHTML();
Output for 5.5.24 - 5.5.28, 5.5.35 - 5.6.12, 5.6.21 - 5.6.28, 7.0.6 - 7.3.0rc4
Warning: DOMDocumentFragment::appendXML(): Entity: line 1: parser error : Premature end of data in tag br line 1 in /in/vYNka on line 8 Warning: DOMDocumentFragment::appendXML(): aasdfasdfa <br> in /in/vYNka on line 8 Warning: DOMDocumentFragment::appendXML(): ^ in /in/vYNka on line 8 Warning: DOMNode::appendChild(): Document Fragment is empty in /in/vYNka on line 9 <div></div>
Output for 5.1.0 - 5.4.45, 5.5.29 - 5.5.34, 5.6.13 - 5.6.20, 7.0.0 - 7.0.5
Warning: DOMDocumentFragment::appendXML(): Entity: line 1: parser error : Premature end of data in tag br line 1 in /in/vYNka on line 8 Warning: DOMNode::appendChild(): Document Fragment is empty in /in/vYNka on line 9 <div></div>
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined method DOMDocumentFragment::appendXML() in /in/vYNka on line 8
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/vYNka on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/vYNka on line 2