<?php
$doc = new DOMDocument();
$doc->loadXML('<html><example a="b">Test</example></html>');
$example = $doc->getElementsByTagName('example')->item(0);
$attr = $example->getAttributeNode('a');
var_dump($attr);
print_r($attr);
- Output for 8.3.0 - 8.3.4
- object(DOMAttr)#2 (23) {
["specified"]=>
bool(true)
["schemaTypeInfo"]=>
NULL
["name"]=>
string(1) "a"
["value"]=>
string(1) "b"
["ownerElement"]=>
string(22) "(object value omitted)"
["nodeName"]=>
string(1) "a"
["nodeValue"]=>
string(1) "b"
["nodeType"]=>
int(2)
["parentNode"]=>
string(22) "(object value omitted)"
["parentElement"]=>
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
["isConnected"]=>
bool(true)
["ownerDocument"]=>
string(22) "(object value omitted)"
["namespaceURI"]=>
NULL
["prefix"]=>
string(0) ""
["localName"]=>
string(1) "a"
["baseURI"]=>
string(1) "/"
["textContent"]=>
string(1) "b"
}
DOMAttr Object
(
[specified] => 1
[schemaTypeInfo] =>
[name] => a
[value] => b
[ownerElement] => (object value omitted)
[nodeName] => a
[nodeValue] => b
[nodeType] => 2
[parentNode] => (object value omitted)
[parentElement] => (object value omitted)
[childNodes] => (object value omitted)
[firstChild] => (object value omitted)
[lastChild] => (object value omitted)
[previousSibling] =>
[nextSibling] =>
[attributes] =>
[isConnected] => 1
[ownerDocument] => (object value omitted)
[namespaceURI] =>
[prefix] =>
[localName] => a
[baseURI] => /
[textContent] => b
)
- Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.17
- object(DOMAttr)#2 (21) {
["specified"]=>
bool(true)
["schemaTypeInfo"]=>
NULL
["name"]=>
string(1) "a"
["value"]=>
string(1) "b"
["ownerElement"]=>
string(22) "(object value omitted)"
["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"
}
DOMAttr Object
(
[specified] => 1
[schemaTypeInfo] =>
[name] => a
[value] => b
[ownerElement] => (object value omitted)
[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
)
- Output for 7.0.20, 7.1.5 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
- object(DOMAttr)#2 (21) {
["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
["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"
}
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] =>
[nextSibling] =>
[attributes] =>
[ownerDocument] => (object value omitted)
[namespaceURI] =>
[prefix] =>
[localName] => a
[baseURI] => /
[textContent] => b
)
- Output for 7.1.0
- Warning: var_dump(): Not yet implemented in /in/H3Z6B 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/H3Z6B 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.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.14
- Warning: var_dump(): Not yet implemented in /in/H3Z6B 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/H3Z6B 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.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.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/H3Z6B on line 6
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
- Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/H3Z6B on line 6
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/H3Z6B on line 6
Process exited with code 255.
preferences:
266.77 ms | 401 KiB | 391 Q