3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = new DOMdocument("1.0", "UTF-8"); $xml->preserveWhiteSpace = true; $root = $xml->createElement("Comprobante"); $root = $xml->appendChild($root); $xml->appendChild($attr); $attr1 = $xml->createTextNode("version"); $xml->appendChild($attr1); $attr = $xml->createTextNode($root->setAttribute("LugarExpedicion", "CULIACÁN, SINALOA")); //$root->setAttribute("LugarExpedicion", "CULIACÁN, SINALOA"); //$root->setAttribute("version", "3.2"); /*$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-NAME'); $sub2Node = $rootNode->appendChild($rootElt); $textNode = $domDoc->createTextNode('John'); $sub2Node->appendChild($textNode);*/ $xml->formatOutput = true; //$domDoc->save('config.xml'); echo $xml->saveXML();
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $attr in /in/VifEa on line 7 Fatal error: Uncaught TypeError: DOMNode::appendChild(): Argument #1 ($node) must be of type DOMNode, null given in /in/VifEa:7 Stack trace: #0 /in/VifEa(7): DOMNode->appendChild(NULL) #1 {main} thrown in /in/VifEa on line 7
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
186.87 ms | 406 KiB | 5 Q