XML::offsetUnset()

Deletes an attribute.

Table of Contents
  1. Description
  2. Example

Description

XML::offsetUnset(mixed $key): 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 delete an attribute with array access syntax.

Example

$node = new XML('<input name="test" value=""/>');

$node['value'] = null;
unset($node['name']);

echo $node; // Returns `<input/>`

XML::offsetUnset()

Deletes an attribute.