3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DOMDocument('1.0', 'utf8'); $doc->loadxml('<node><a>old content</a><a>2</a></node>'); $productRaw = $doc->getElementsByTagName('a'); print_r($productRaw[0]);
Output for 8.3.0 - 8.3.4
DOMElement Object ( [schemaTypeInfo] => [tagName] => a [className] => [id] => [firstElementChild] => [lastElementChild] => [childElementCount] => 0 [previousElementSibling] => [nextElementSibling] => (object value omitted) [nodeName] => a [nodeValue] => old content [nodeType] => 1 [parentNode] => (object value omitted) [parentElement] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => (object value omitted) [attributes] => (object value omitted) [isConnected] => 1 [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => a [baseURI] => / [textContent] => old content )
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.17
DOMElement Object ( [schemaTypeInfo] => [tagName] => a [firstElementChild] => [lastElementChild] => [childElementCount] => 0 [previousElementSibling] => [nextElementSibling] => (object value omitted) [nodeName] => a [nodeValue] => old content [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => a [baseURI] => / [textContent] => old content )
Output for 8.0.0 - 8.0.30
DOMElement Object ( [tagName] => a [schemaTypeInfo] => [firstElementChild] => [lastElementChild] => [childElementCount] => 0 [previousElementSibling] => [nextElementSibling] => (object value omitted) [nodeName] => a [nodeValue] => old content [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => a [baseURI] => / [textContent] => old content )
Output for 5.6.3 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
DOMElement Object ( [tagName] => a [schemaTypeInfo] => [nodeName] => a [nodeValue] => old content [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => a [baseURI] => / [textContent] => old content )
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.2
Fatal error: Cannot use object of type DOMNodeList as array in /in/0v8lu on line 8
Process exited with code 255.

preferences:
237.14 ms | 401 KiB | 326 Q