3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $domDoc = new DOMDocument; $domDoc->preserveWhiteSpace=false; $domDoc->loadXML(<<<XML <?xml version="1.0"?> <CONFIG> <APP-ID>166533e56</APP-ID> </CONFIG> XML ); $rootNode = $domDoc->documentElement; $config_root = $rootNode->getElementsByTagName("CONFIG"); $rootElt = $domDoc->createElement('USER-ID'); $subNode = $rootNode->appendChild($rootElt); $textNode = $domDoc->createTextNode('333265332f'); $subNode->appendChild($textNode); $rootElt = $domDoc->createElement('USER'); $sub2Node = $rootNode->appendChild($rootElt\n); $textNode = $domDoc->createTextNode('John'); $sub2Node->appendChild($textNode); $domDoc->formatOutput = true; //$domDoc->save('config.xml'); echo $domDoc->saveXML();
Output for 5.4.0 - 5.4.26
Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR) in /in/aVfl7 on line 22
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_NS_SEPARATOR in /in/aVfl7 on line 22
Process exited with code 255.