3v4l.org

run code in 300+ PHP versions simultaneously
<?php //creating an XML document $dom = new DOMDocument('1.0'); $dom->xmlStandalone = false; //create element manifest $manfiestNode = $dom->createElement('manifest',""); $dom->importNode($manifiestNode); //create attribute identifier $manfiestNodeAttr = $dom->createAttribute('identifier'); //value for the manifest node identifier value $date = new DateTime(); $manfiestNodeAttr->value = 'course_'.date_format($date,'U'); //append attribute to the manifest element $manfiestNode->appendChild($manfiestNodeAttr); $manfiestNode->appendChild($dom->createAttribute('xmlns:xsi'))->appendChild($dom->createTextNode("http://www.w3.org/2001/XMLSchema-instance")); //add metadata element under manifest node $metaData = $dom->createElement('metadata',''); //add metadata element to manifest node $manfiestNode->appendChild($metaData); //create schema and schemaversion element under metatag $schema = $dom->createElement('schema','ADL SCORM'); $schemaVersion = $dom->createElement('schemaversion', '2004 3rd Edition'); //create schema and schemaversion element under metatag $metaData->appendChid($schema); $metaData->appendChid($schemaVersion); //append manifest element to the document $dom->appendChild($manfiestNode); var_dump($dom->saveXML());
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $manifiestNode in /in/49723 on line 9 Fatal error: Uncaught TypeError: DOMDocument::importNode(): Argument #1 ($node) must be of type DOMNode, null given in /in/49723:9 Stack trace: #0 /in/49723(9): DOMDocument->importNode(NULL) #1 {main} thrown in /in/49723 on line 9
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:
37.01 ms | 401 KiB | 8 Q