3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo() { $html = '<b>Hello</b><i>World</i>'; $doc = new DOMDocument(); $element = $doc->createDocumentFragment(); $element->appendXML($html); foreach ($element->childNodes as $child) { $element = null; //$doc = null; var_dump($child->nodeValue); } } foo();
based on ZJYYd
Output for 5.1.0 - 7.2.0
string(5) "Hello" string(5) "World"
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined method DOMDocumentFragment::appendXML() in /in/Vrnqm on line 6
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/Vrnqm on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/Vrnqm on line 4