3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dom = new DOMDocument(); $frag1 = $dom->createDocumentFragment(); $frag1->normalize(); var_dump($dom->saveHTML($frag1)); $frag2 = $dom->createDocumentFragment(); $frag2->appendChild($dom->createElement('div')); $frag2->normalize(); var_dump($dom->saveHTML($frag2));
Output for 5.4.24 - 5.6.28, 7.0.0 - 7.1.0
string(0) "" string(11) "<div></div>"
Output for 5.3.6 - 5.4.23, hhvm-3.10.0 - 3.12.0
string(5) "<></>" string(16) "<><div></div></>"
Output for 5.0.0 - 5.3.5
Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given in /in/AmfTt on line 7 NULL Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given in /in/AmfTt on line 12 NULL
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/AmfTt on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/AmfTt on line 3