3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $doc = new DOMDocument; $doc->loadXML('<tridas:object> <tridas:title>ppp</tridas:title> <tridas:type normalStd="Tellervo" normalId="1" normal="Site"/> <tridas:genericField name="tellervo.objectLabCode">2222</tridas:genericField> </tridas:object> '); $tellervoNS = "http://www.tellervo.org/schema/1.0"; $tridasNS = "http://www.tridas.org/1.2.2"; $xpath = new DOMXPath($doc); $xpath->registerNamespace('cor', $tellervoNS); $xpath->registerNamespace('tridas', $tridasNS); $fragment = $xpath->query("/cor:tellervo/cor:request/*"); foreach ($fragment as $item) { echo $item->nodeName, ' / ', $item->tagName; }
Output for 5.0.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: DOMDocument::loadXML(): Namespace prefix tridas on object is not defined in Entity, line: 1 in /in/fN9ht on line 5 Warning: DOMDocument::loadXML(): Namespace prefix tridas on title is not defined in Entity, line: 1 in /in/fN9ht on line 5 Warning: DOMDocument::loadXML(): Namespace prefix tridas on type is not defined in Entity, line: 1 in /in/fN9ht on line 5 Warning: DOMDocument::loadXML(): Namespace prefix tridas on genericField is not defined in Entity, line: 1 in /in/fN9ht on line 5
Output for hhvm-3.10.0 - 3.12.0
Warning: Namespace prefix tridas on object is not defined in Entity, line: 1 Warning: Namespace prefix tridas on title is not defined in Entity, line: 1 Warning: Namespace prefix tridas on type is not defined in Entity, line: 1 Warning: Namespace prefix tridas on genericField is not defined in Entity, line: 1
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/fN9ht 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/fN9ht on line 2