3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = new SimpleXMLElement('<sorrow/>'); $dom = new DOMDocument('1.0', 'utf-8'); $dom->appendChild(new DOMCdataSection('jfoaiwejf eoaijfc 9e8a 98agh98fhaeh(g8dshg9a8dhsf78afgg>?>><?DS<F?>D')); $xml->addChild($dom->saveXML($dom->documentElement)); echo $xml->asXML();
Output for 5.1.3 - 5.2.5, 5.2.7 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<?xml version="1.0"?> <sorrow><<?xml version="1.0" encoding="utf-8"?> <![CDATA[jfoaiwejf eoaijfc 9e8a 98agh98fhaeh(g8dshg9a8dhsf78afgg>?>><?DS<F?>D]]> /></sorrow>
Output for 5.2.6
Catchable fatal error: Argument 1 passed to DOMDocument::saveXML() must be an instance of DOMNode, null given in /in/0vUYo on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.2
Fatal error: Call to undefined method SimpleXMLElement::addChild() in /in/0vUYo on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/0vUYo on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/0vUYo on line 2