HTML::offsetUnset()

Deletes an attribute.

Table of Contents
  1. Description
  2. Example

Description

HTML::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 HTML('<input name="test" value="">');

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

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

HTML::offsetUnset()

Deletes an attribute.