3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = new DOMDocument(); //$xml->loadXML('<root><node/></root>'); $root = $xml->createElement("root"); $xml->appendChild($root); $xpath = new DOMXpath($xml); $el = $xml->createElement("testnode", "some val"); $root->appendChild($el); $xml->formatOutput = true; echo $xml->saveXML(); $entries = $xpath->query("/root/testnode[1]"); echo "test xpath: "; foreach($entries as $entry) { echo $entry->nodeValue; }
Output for 5.0.0 - 7.1.0
<?xml version="1.0"?> <root> <testnode>some val</testnode> </root> test xpath: some val
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/83hpu on line 2
Process exited with code 255.
Output for 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/83hpu on line 2
Output for 4.3.0
Fatal error: Cannot instantiate non-existent class: domdocument in /in/gg85l on line 2