3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dom = new DOMDocument(); $created = $dom->createComment('foo'); $imported = $dom->importNode($created); var_dump($imported);
based on XnBAp
Output for 5.3.11 - 5.3.29, 5.4.1 - 5.6.21, 7.0.0 - 7.1.0
object(DOMComment)#2 (17) { ["data"]=> string(3) "foo" ["length"]=> int(3) ["nodeName"]=> string(8) "#comment" ["nodeValue"]=> string(3) "foo" ["nodeType"]=> int(8) ["parentNode"]=> NULL ["childNodes"]=> NULL ["firstChild"]=> NULL ["lastChild"]=> NULL ["previousSibling"]=> NULL ["attributes"]=> NULL ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> NULL ["baseURI"]=> NULL ["textContent"]=> string(3) "foo" }
Output for hhvm-3.12.0
object(DOMComment)#2 (18) { ["nodeName"]=> string(8) "#comment" ["nodeValue"]=> string(3) "foo" ["nodeType"]=> int(8) ["parentNode"]=> NULL ["childNodes"]=> NULL ["firstChild"]=> NULL ["lastChild"]=> NULL ["previousSibling"]=> NULL ["nextSibling"]=> NULL ["attributes"]=> NULL ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> NULL ["baseURI"]=> NULL ["textContent"]=> string(3) "foo" ["data"]=> string(3) "foo" ["length"]=> int(3) }
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.0 - 5.3.10, 5.4.0
object(DOMComment)#2 (0) { }
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/47AU8 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/47AU8 on line 3