PHP 8.4.24 Released!

DOMElement::getAttributeNames

(PHP 8 >= 8.3.0)

DOMElement::getAttributeNamesRenvoie les noms des attributs

Description

public function DOMElement::getAttributeNames(): array

Obtenir les noms des attributs.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

Renvoie les noms des attributs.

Exemples

Exemple #1 Exemple de DOMElement::getAttributeNames()

<?php

$dom = new DOMDocument();
$dom->loadXML('<html xmlns:some="some:ns" some:test="a" test2="b"/>');
var_dump($dom->documentElement->getAttributeNames());
?>

L'exemple ci-dessus va afficher :

array(3) {
  [0]=>
  string(10) "xmlns:some"
  [1]=>
  string(9) "some:test"
  [2]=>
  string(5) "test2"
}
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top