DOMElement::getAttributeNames
PHP function
Edit on GitHub ✎
(PHP 8 >= 8.3.0)
Get attribute names
Description
DOMElement::getAttributeNames(): array
Get attribute names.
Parameters Parameters
Return Values
Return attribute names.
Examples
DOMElement::getAttributeNames example
php
<?php
$dom = new DOMDocument();
$dom->loadXML('<html xmlns:some="some:ns" some:test="a" test2="b"/>');
var_dump($dom->documentElement->getAttributeNames());
?>The above example will output:
output
array(3) {
[0]=>
string(10) "xmlns:some"
[1]=>
string(9) "some:test"
[2]=>
string(5) "test2"
}