XML::offsetSet()
Sets the attribute’s value.
Table of Contents
Description
XML::offsetSet(mixed $key, mixed $value): void;
This method is a requirement to be able to implement the ArrayAccess
interface and aims to make the object data modifiable using array access syntax. You won’t use this method directly, it will be executed automatically when you try to set an attribute’s value with array access syntax.
Example
$node = new XML('<a name="test"></a>');
$node[0] = 'input';
echo $node; // Returns `'<input name="test"></input>'`
$node[1] = false;
echo $node; // Returns `'<input name="test"/>'`
$node['disabled'] = true;
$node['type'] = 'text';
$node['value'] = 'aaa"bbb';
echo $node; // Returns `'<input disabled="disabled" name="test" type="text" value="aaa"bbb"/>'`
XML::_()
The dynamic method initiator.
XML::__call()
Proxy for missing methods.
XML::__callStatic()
Proxy for missing static methods.
XML::__construct()
The constructor.
XML::__serialize()
Provides data to be serialized.
XML::__toString()
Converts the XML object to string.
XML::__unserialize()
Converts the serialized data back to its object.
XML::count()
Nothing.
XML::jsonSerialize()
Returns the data to be serialized as JSON.
XML::offsetExists()
Checks if an attribute exists.
XML::offsetGet()
Gets the attribute’s value.
XML::offsetSet()
Sets the attribute’s value.
XML::offsetUnset()
Deletes an attribute.