3v4l.org

run code in 150+ 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.3.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<div>aasdfasdfa <br></div>
Output for 5.1.0 - 5.3.2
<div>aasdfasdfa <br> </div>
Output for 5.0.0 - 5.0.5
<br /> <b>Fatal error</b>: Call to undefined method DOMDocumentFragment::appendXML() in <b>/in/DFW1P</b> on line <b>8</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.4.9
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: domdocument in <b>/in/DFW1P</b> on line <b>2</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: domdocument in <b>/in/DFW1P</b> on line <b>2</b><br />