DOMDocument::createAttribute
PHP function
Edit on GitHub ✎
(PHP 5, PHP 7, PHP 8)
Create new attribute
Description
DOMDocument::createAttribute(string $localName): DOMAttr|false
This function creates a new instance of class DOMAttr. Inserted
Parameters
localNameThe name of the attribute.
Return Values
The new DOMAttr or false if an error occurred.
Errors/Exceptions
May throw a DOMException with the following error codes:
DOM_INVALID_CHARACTER_ERRRaised if
localNamecontains an invalid character.
See Also
DOMNode::appendChildDOMDocument::createAttributeNSDOMDocument::createCDATASectionDOMDocument::createCommentDOMDocument::createDocumentFragmentDOMDocument::createElementDOMDocument::createElementNSDOMDocument::createEntityReferenceDOMDocument::createProcessingInstructionDOMDocument::createTextNode