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->name); print_r($attr);
Output for 7.1.0
string(1) "a" Warning: print_r(): Not yet implemented in /in/qHZRC 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 - 7.0.14
string(1) "a" DOMAttr Object Warning: print_r(): Not yet implemented in /in/qHZRC 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 5.0.0 - 5.3.10, 5.4.0
string(1) "a" DOMAttr Object ( )
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/qHZRC 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/qHZRC on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/qHZRC on line 6
Process exited with code 255.