3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = <<<XML <html> <head><title></title></head> <body> <content type="text">the content</content> </body> </html> XML; $xe = new SimpleXMLElement($xml); $ne = new SimpleXMLElement("<div></div>"); $xe->body->content = $ne; echo $xe->asXML();
Output for 5.2.2 - 7.2.6
<?xml version="1.0"?> <html> <head><title/></head> <body> <content type="text"></content> </body> </html>
Output for 5.1.3 - 5.2.1
<br /> <b>Warning</b>: main() [<a href='function.main'>function.main</a>]: It is not yet possible to assign complex types to properties in <b>/in/4n1pi</b> on line <b>12</b><br /> <br /> <b>Warning</b>: main() [<a href='function.main'>function.main</a>]: It is not possible to assign complex types to nodes in <b>/in/4n1pi</b> on line <b>12</b><br /> <?xml version="1.0"?> <html> <head><title/></head> <body> <content type="text"/> </body> </html>
Output for 5.1.2
<br /> <b>Warning</b>: main() [<a href='function.main'>function.main</a>]: It is not possible to assign complex types to nodes in <b>/in/4n1pi</b> on line <b>13</b><br /> <?xml version="1.0"?> <html> <head><title/></head> <body> <content type="text"/> </body> </html>
Output for 5.0.1 - 5.1.1
<br /> <b>Warning</b>: main() [<a href='function.main'>function.main</a>]: It is not possible to assign complex types to nodes in <b>/in/4n1pi</b> on line <b>12</b><br /> <?xml version="1.0"?> <html> <head><title/></head> <body> <content type="text"/> </body> </html>
Output for 5.0.0
<br /> <b>Warning</b>: It is not possible to assign complex types to nodes in <b>/in/4n1pi</b> on line <b>12</b><br /> <?xml version="1.0"?> <html> <head><title/></head> <body> <content type="text"/> </body> </html>
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.9
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: simplexmlelement in <b>/in/4n1pi</b> on line <b>10</b><br />
Process exited with code 255.
Output for 4.4.2
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: simplexmlelement in <b>/in/4n1pi</b> on line <b>11</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: simplexmlelement in <b>/in/4n1pi</b> on line <b>10</b><br />