PHP addAttribute() Function

The addAttribute() function adds an attribute to the SimpleXML element.

public void SimpleXMLElement::addAttribute ( string $name [, string $value [, string $namespace ]] )

Adds an attribute to the SimpleXML element.

Example -

ParameterDescription
nameThe name of the attribute to add.
valueThe value of the attribute.
namespaceIf specified, the namespace to which the attribute belongs.

No value is returned.