3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dom = new DOMDOcument(); $dom->load("myxmlfile.xml"); foreach($dom->documentElement->childNodes as $child) { if(($child->nodeType == XML_ELEMENT_NODE) && $child->nodeName == "item") { foreach($child->childNodes as $item) { if(($item->nodeType == XML_ELEMENT_NODE) && ($item->nodeName == "title")) { print "$item->firstChild->data\n"; } } } } ?>
based on TesmF
Output for 5.2.3 - 7.1.0
Warning: DOMDocument::load(): I/O warning : failed to load external entity "/myxmlfile.xml" in /in/q6tSg on line 3 Notice: Trying to get property of non-object in /in/q6tSg on line 5 Warning: Invalid argument supplied for foreach() in /in/q6tSg on line 5
Output for 5.2.1 - 5.2.2
Warning: DOMDocument::load(): I/O warning : failed to load external entity "/in/myxmlfile.xml" in /in/q6tSg on line 3 Notice: Trying to get property of non-object in /in/q6tSg on line 5 Warning: Invalid argument supplied for foreach() in /in/q6tSg on line 5
Output for 5.1.0 - 5.2.0
Warning: DOMDocument::load(): I/O warning : failed to load external entity "/in/myxmlfile.xml" in /in/q6tSg on line 3 Warning: Invalid argument supplied for foreach() in /in/q6tSg on line 5
Output for 5.0.0 - 5.0.5
Warning: I/O warning : failed to load external entity "/in/myxmlfile.xml" in /in/q6tSg on line 3 Warning: Invalid argument supplied for foreach() in /in/q6tSg on line 5
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/q6tSg on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/q6tSg on line 2