3v4l.org

run code in 300+ PHP versions simultaneously
<?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); var_dump($val-nodeValue);
Output for 8.3.0 - 8.3.6
DOMElement Object ( [schemaTypeInfo] => [tagName] => root [className] => [id] => [firstElementChild] => (object value omitted) [lastElementChild] => (object value omitted) [childElementCount] => 2 [previousElementSibling] => [nextElementSibling] => [nodeName] => root [nodeValue] => [nodeType] => 1 [parentNode] => (object value omitted) [parentElement] => [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => [attributes] => (object value omitted) [isConnected] => 1 [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => root [baseURI] => / [textContent] => ) Fatal error: Uncaught Error: Undefined constant "nodeValue" in /in/DdJVG:17 Stack trace: #0 {main} thrown in /in/DdJVG on line 17
Process exited with code 255.
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
DOMElement Object ( [schemaTypeInfo] => [tagName] => root [firstElementChild] => (object value omitted) [lastElementChild] => (object value omitted) [childElementCount] => 2 [previousElementSibling] => [nextElementSibling] => [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] => ) Fatal error: Uncaught Error: Undefined constant "nodeValue" in /in/DdJVG:17 Stack trace: #0 {main} thrown in /in/DdJVG on line 17
Process exited with code 255.
Output for 8.0.0 - 8.0.30
DOMElement Object ( [tagName] => root [schemaTypeInfo] => [firstElementChild] => (object value omitted) [lastElementChild] => (object value omitted) [childElementCount] => 2 [previousElementSibling] => [nextElementSibling] => [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] => ) Fatal error: Uncaught Error: Undefined constant "nodeValue" in /in/DdJVG:17 Stack trace: #0 {main} thrown in /in/DdJVG on line 17
Process exited with code 255.
Output for 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
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] => ) Warning: Use of undefined constant nodeValue - assumed 'nodeValue' (this will throw an Error in a future version of PHP) in /in/DdJVG on line 17 Notice: Object of class DOMElement could not be converted to number in /in/DdJVG on line 17 Warning: A non-numeric value encountered in /in/DdJVG on line 17 int(1)
Output for 7.3.32 - 7.3.33
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] => ) Warning: Use of undefined constant nodeValue - assumed 'nodeValue' (this will throw an Error in a future version of PHP) in /in/DdJVG on line 17 Warning: A non-numeric value encountered in /in/DdJVG on line 17 int(1)
Output for 7.2.0 - 7.2.33
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] => ) Warning: Use of undefined constant nodeValue - assumed 'nodeValue' (this will throw an Error in a future version of PHP) in /in/DdJVG on line 17 Notice: Object of class DOMElement could not be converted to int in /in/DdJVG on line 17 Warning: A non-numeric value encountered in /in/DdJVG on line 17 int(1)
Output for 7.1.5 - 7.1.20
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] => ) Notice: Use of undefined constant nodeValue - assumed 'nodeValue' in /in/DdJVG on line 17 Notice: Object of class DOMElement could not be converted to int in /in/DdJVG on line 17 Warning: A non-numeric value encountered in /in/DdJVG on line 17 int(1)
Output for 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] => ) Notice: Use of undefined constant nodeValue - assumed 'nodeValue' in /in/DdJVG on line 17 Notice: Object of class DOMElement could not be converted to int in /in/DdJVG on line 17 Warning: A non-numeric value encountered in /in/DdJVG on line 17 int(1)
Output for 7.0.20
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] => ) Notice: Use of undefined constant nodeValue - assumed 'nodeValue' in /in/DdJVG on line 17 Notice: Object of class DOMElement could not be converted to int in /in/DdJVG on line 17 int(1)
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.7
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] => ) Notice: Use of undefined constant nodeValue - assumed 'nodeValue' in /in/DdJVG on line 17 Notice: Object of class DOMElement could not be converted to int in /in/DdJVG on line 17 int(1)

preferences:
166.85 ms | 404 KiB | 184 Q