← All built-ins / unset()

unset()

unset(...$args): void

Parameters

NameTypeDescription
$varmixedarray element to remove

Return value

Removes the element from the array.

Example

$m = ["a" => 1, "b" => 2];
unset($m["a"]);
echo count($m), " ", $m["b"];
1 2

See also

isset()array_splice()