3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // "Create" the document. $xml = new DOMDocument( "1.0", "ISO-8859-15" ); //to have indented output, not just a line $xml->preserveWhiteSpace = false; $xml->formatOutput = true; // ------------- Interresting part here ------------ //creating an xslt adding processing line $xslt = $xml->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="base.xsl"'); //adding it to the xml $xml->appendChild($xslt); // ----------- / Interresting part here ------------- //adding some elements $root = $xml->createElement("list"); $node = $xml->createElement("contact", "John Doe"); $root-> appendChild($node); $xml-> appendChild($root); //creating the file $xml-> save("output.xml"); ?>
Output for 5.1.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: DOMDocument::save(output.xml): failed to open stream: Permission denied in /in/3es0t on line 27
Output for hhvm-3.12.0
Warning: Permission denied in /in/3es0t on line 27
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.0 - 5.0.5
Warning: DOMDocument::save(output.xml): failed to open stream: Permission denied in /in/3es0t on line 27 Warning: DOMDocument::save(output.xml): failed to open stream: Permission denied in /in/3es0t on line 27
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/3es0t on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/3es0t on line 4