3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $doc = new DOMDocument(); $doc->loadXML('<example a="b">Test</example>'); $example = $doc->getElementsByTagName('example')->item(0); $attr = $example->getAttributeNode('a'); var_dump($attr); print_r($attr);
Output for 7.1.0
Warning: var_dump(): Not yet implemented in /in/rC5bi on line 9 object(DOMAttr)#2 (20) { ["name"]=> string(1) "a" ["specified"]=> bool(true) ["value"]=> string(1) "b" ["ownerElement"]=> string(22) "(object value omitted)" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(1) "a" ["nodeValue"]=> string(1) "b" ["nodeType"]=> int(2) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> NULL ["attributes"]=> NULL ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "a" ["baseURI"]=> string(1) "/" ["textContent"]=> string(1) "b" } Warning: print_r(): Not yet implemented in /in/rC5bi on line 10 DOMAttr Object ( [name] => a [specified] => 1 [value] => b [ownerElement] => (object value omitted) [schemaTypeInfo] => [nodeName] => a [nodeValue] => b [nodeType] => 2 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [attributes] => [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => a [baseURI] => / [textContent] => b )
Output for 5.3.11 - 5.3.29, 5.4.1 - 5.6.28, 7.0.0 - 7.0.14
Warning: var_dump(): Not yet implemented in /in/rC5bi on line 9 object(DOMAttr)#2 (20) { ["name"]=> string(1) "a" ["specified"]=> bool(true) ["value"]=> string(1) "b" ["ownerElement"]=> string(22) "(object value omitted)" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(1) "a" ["nodeValue"]=> string(1) "b" ["nodeType"]=> int(2) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> NULL ["attributes"]=> NULL ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "a" ["baseURI"]=> string(1) "/" ["textContent"]=> string(1) "b" } DOMAttr Object Warning: print_r(): Not yet implemented in /in/rC5bi on line 10 ( [name] => a [specified] => 1 [value] => b [ownerElement] => (object value omitted) [schemaTypeInfo] => [nodeName] => a [nodeValue] => b [nodeType] => 2 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [attributes] => [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => a [baseURI] => / [textContent] => b )
Output for hhvm-3.10.0 - 3.13.2
Warning: Not yet implemented object(DOMAttr)#4 (21) { ["nodeName"]=> string(1) "a" ["nodeValue"]=> string(1) "b" ["nodeType"]=> int(2) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> NULL ["nextSibling"]=> NULL ["attributes"]=> NULL ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "a" ["baseURI"]=> string(1) "/" ["textContent"]=> string(1) "b" ["name"]=> string(1) "a" ["specified"]=> bool(true) ["value"]=> string(1) "b" ["ownerElement"]=> string(22) "(object value omitted)" ["schemaTypeInfo"]=> NULL } Warning: Not yet implemented in /in/rC5bi on line 10 DOMAttr Object ( [nodeName] => a [nodeValue] => b [nodeType] => 2 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => [attributes] => [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => a [baseURI] => / [textContent] => b [name] => a [specified] => 1 [value] => b [ownerElement] => (object value omitted) [schemaTypeInfo] => )
Output for 5.0.0 - 5.3.10, 5.4.0
object(DOMAttr)#2 (0) { } DOMAttr Object ( )
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/rC5bi on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/rC5bi on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/rC5bi on line 6
Process exited with code 255.