3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = "<root> <parent> <child name='Child1' /> <child name='Child2' /> <subparent> <child name='Child3' /> </subparent> </parent> <child name='Child4' /> </root>"; $dom=new DOMDocument(); $dom->loadXML($xml); $val=$dom->getElementsByTagName('root')->item(0); print_r($val);
based on 6m8RY
Output for 7.0.20, 7.1.5 - 7.2.0
DOMElement Object ( [tagName] => root [schemaTypeInfo] => [nodeName] => root [nodeValue] => [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => root [baseURI] => / [textContent] => )
Output for 5.3.19 - 7.0.6, 7.1.0
DOMElement Object ( [tagName] => root [schemaTypeInfo] => [nodeName] => root [nodeValue] => [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => root [baseURI] => / [textContent] => )