(PHP 5, PHP 7, PHP 8)
DOMElement::setAttributeNode — Añade un nuevo atributo al elemento
Añade un nuevo atributo attr al elemento.
Si ya existe un atributo con el mismo nombre en el elemento, este atributo es reemplazado por
attr.
attrEl atributo.
Devuelve el atributo antiguo si ha sido reemplazado o null si no había un atributo antiguo.
Si se produce un error DOM_WRONG_DOCUMENT_ERR y strictErrorChecking es false, entonces false es devuelto.
DOM_WRONG_DOCUMENT_ERR
Lanzado si attr pertenece a un documento diferente al del elemento.