Home > PHP > Function > DOM XML (PHP 4) > DomElement->set_attribute()

DomElement->set_attribute()

DomElement->set_attribute - Sets the value of an attribute

Syntax

DomAttribute DomElement->set_attribute (string $name, string $value)

Arguments

  • name - The name of the attribute. If this attribute doesn\'t exist, it will be created.
  • value - The value of the attribute.

Description

Sets an attribute with name name to the given value.

Version

PHP 4.1.0

Return value

Returns the old DomAttributenode, or the new one if you are creating the attribute for the first time.