delete.php
Table of Contents
Functions
- delete() : mixed
- Unset a key or nested key in an array using dot notation.
Functions
delete()
Unset a key or nested key in an array using dot notation.
delete(mixed $target, string|array<string|int, mixed> $key[, string $separator = '.' ]) : mixed
- If the key is '*', clears the whole array.
- Supports string path ("a.b.c") or array path (['a','b','c']).
- If the path is partially invalid, the array is returned unchanged.
Parameters
- $target : mixed
-
The array to modify (ignored if not an array).
- $key : string|array<string|int, mixed>
-
The key path to delete.
- $separator : string = '.'
-
The separator for string key paths (default: '.').
Tags
Return values
mixed —The modified array (or original if not an array).