array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'domelement.setattributenode.php', 1 => 'DOMElement::setAttributeNode', ), 'up' => array ( 0 => 'class.domelement.php', 1 => 'DOMElement', ), 'prev' => array ( 0 => 'domelement.setattribute.php', 1 => 'DOMElement::setAttribute', ), 'next' => array ( 0 => 'domelement.setattributenodens.php', 1 => 'DOMElement::setAttributeNodeNS', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'pt_BR', 'path' => 'reference/dom/domelement/setattributenode.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5, PHP 7, PHP 8)
DOMElement::setAttributeNode — Adiciona um novo nó de atributo ao elemento
Adiciona um novo nó de atributo attr
ao elemento.
Se um atributo com o mesmo nome já existir no elemento, esse atributo será substituído por attr
.
attr
O nó de atributo.
Retorna o atributo antigo se tiver sido substituído ou null
se não houver atributo antigo.
Se ocorrer um erro de DOM_WRONG_DOCUMENT_ERR
, e strictErrorChecking for false
, false
será retornado.
DOM_WRONG_DOCUMENT_ERR
Gerado se attr
pertencer a um documento diferente do elemento.