3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $root = new DOMDocument(); $root->loadXML('<article id=""></article>'); $node = new DOMDocument(); $node->loadXML('<section><h1>Überschrift1</h1><h2>Überschrift2</h2><p>Content</p></section>'); $node = $root->importNode($node->documentElement, true); $root->documentElement->appendChild($node); $node = $root->importNode($node->documentElement, true); $root->documentElement->appendChild($node); print $root->saveXML();
based on S3cVg
Output for 7.0.0 - 7.3.0rc3
Notice: Undefined property: DOMElement::$documentElement in /in/TR5fb on line 11 Fatal error: Uncaught TypeError: Argument 1 passed to DOMDocument::importNode() must be an instance of DOMNode, null given in /in/TR5fb:11 Stack trace: #0 /in/TR5fb(11): DOMDocument->importNode(NULL, true) #1 {main} thrown in /in/TR5fb on line 11
Process exited with code 255.
Output for hhvm-3.15.4
Notice: Undefined property: DOMElement::$documentElement in /in/TR5fb on line 11 Warning: importNode() expects parameter 1 to be object, null given in /in/TR5fb on line 11 Warning: appendChild() expects parameter 1 to be object, null given in /in/TR5fb on line 12 <?xml version="1.0"?> <article id=""><section><h1>&#xDC;berschrift1</h1><h2>&#xDC;berschrift2</h2><p>Content</p></section></article>
Output for 5.6.0 - 5.6.30
Notice: Undefined property: DOMElement::$documentElement in /in/TR5fb on line 11 Catchable fatal error: Argument 1 passed to DOMDocument::importNode() must be an instance of DOMNode, null given in /in/TR5fb on line 11
Process exited with code 255.