exists.php
Table of Contents
Functions
- exists() : bool
- Checks whether a key exists in an array or an object implementing ArrayAccess.
Functions
exists()
Checks whether a key exists in an array or an object implementing ArrayAccess.
exists(array<string|int, mixed>|ArrayAccess $array, string|int|null $key[, string $separator = '.' ]) : bool
- Returns
false
if the key isnull
or an empty string. - Supports both native arrays and
ArrayAccess
objects.
Parameters
- $array : array<string|int, mixed>|ArrayAccess
-
The array or object to inspect.
- $key : string|int|null
-
The key to check for existence.
- $separator : string = '.'
-
The separator used in the key path. Default is '.'.
Tags
Return values
bool —True if the key exists, false otherwise.