3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // "Create" the document. $xml = new DOMDocument( "1.0", "ISO-8859-15" ); $xml->xmlVersion = null; $xml->standalone = true; $xml->doctype = null; // Create some elements. $xml_album = $xml->createElement( "Album" ); $xml_track = $xml->createElement( "Track", "The ninth symphony" ); // Set the attributes. $xml_track->setAttribute( "length", "0:01:15" ); $xml_track->setAttribute( "bitrate", "64kb/s" ); $xml_track->setAttribute( "channels", "2" ); // Create another element, just to show you can add any (realistic to computer) number of sublevels. $xml_note = $xml->createElement( "Note", "The last symphony composed by Ludwig van Beethoven." ); // Append the whole bunch. $xml_track->appendChild( $xml_note ); $xml_album->appendChild( $xml_track ); // Repeat the above with some different values.. $xml_track = $xml->createElement( "Track", "Highway Blues" ); $xml_track->setAttribute( "length", "0:01:33" ); $xml_track->setAttribute( "bitrate", "64kb/s" ); $xml_track->setAttribute( "channels", "2" ); $xml_album->appendChild( $xml_track ); $xml->appendChild( $xml_album ); // Parse the XML. print $xml->saveXML();
based on BR9If
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught Error: Cannot write property in /in/rr1vI:8 Stack trace: #0 {main} thrown in /in/rr1vI on line 8
Process exited with code 255.
Output for 5.3.19 - 7.0.20
Fatal error: main(): Cannot write property in /in/rr1vI on line 8
Process exited with code 255.