3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = <<<XML <html> <head><title></title></head> <body> <CONTENT /> </body> </html> XML; $dom = new DOMDocument(); $dom->loadXML($xml); $c = $dom->createDocumentFragment(); $c->appendXML("<h1>heading</h1>"); $dom->body->replaceChild($c,$dom->getElementsByTagName("CONTENT")->item(0)); echo $dom->saveHTML();
Output for 7.0.0 - 7.1.0
Notice: Undefined property: DOMDocument::$body in /in/m8e1e on line 14 Fatal error: Uncaught Error: Call to a member function replaceChild() on null in /in/m8e1e:14 Stack trace: #0 {main} thrown in /in/m8e1e on line 14
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined property: DOMDocument::$body in /in/m8e1e on line 14 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function replaceChild() on a non-object (null)' in /in/m8e1e:14 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.28
Notice: Undefined property: DOMDocument::$body in /in/m8e1e on line 14 Fatal error: Call to a member function replaceChild() on null in /in/m8e1e on line 14
Process exited with code 255.
Output for 5.5.0 - 5.5.35
Notice: Undefined property: DOMDocument::$body in /in/m8e1e on line 14 Fatal error: Call to a member function replaceChild() on a non-object in /in/m8e1e on line 14
Process exited with code 255.
Output for 5.2.3 - 5.4.45
Fatal error: Call to a member function replaceChild() on a non-object in /in/m8e1e on line 14
Process exited with code 255.
Output for 5.1.0 - 5.1.1, 5.1.3 - 5.2.2
<br /> <b>Fatal error</b>: Call to a member function replaceChild() on a non-object in <b>/in/m8e1e</b> on line <b>14</b><br />
Process exited with code 255.
Output for 5.1.2
<br /> <b>Fatal error</b>: Call to a member function replaceChild() on a non-object in <b>/in/m8e1e</b> on line <b>15</b><br />
Process exited with code 255.
Output for 5.0.0 - 5.0.5
<br /> <b>Fatal error</b>: Call to undefined method DOMDocumentFragment::appendXML() in <b>/in/m8e1e</b> on line <b>13</b><br />
Process exited with code 255.
Output for 4.4.3 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_OBJECT_OPERATOR in <b>/in/m8e1e</b> on line <b>14</b><br />
Process exited with code 255.
Output for 4.4.2
<br /> <b>Parse error</b>: syntax error, unexpected T_OBJECT_OPERATOR in <b>/in/m8e1e</b> on line <b>15</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
<br /> <b>Parse error</b>: parse error, unexpected T_OBJECT_OPERATOR in <b>/in/m8e1e</b> on line <b>14</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error in <b>/in/m8e1e</b> on line <b>14</b><br />
Process exited with code 255.