PHP array_key_exists() Function
Last Updated : 17 Mar 2025
The array_key_exists( ) is an builtin function of PHP. The array_key_exists( ) function checks an array for a specified key, and returns true if the key exists and false if the key does not exists. This function was introduced in PHP 4.0.7.
Syntax
| Parameter | Description | Is compulsory |
|---|---|---|
| key | Specifies the key. | compulsory |
| array | Specifies an array. | compulsory |
Return Type
The array_key_exists( ) function returns true if the key exists and false if the key does not exist.
EXAMPLE 1
Output:
Key does not exist!
EXAMPLE 2
Output:
Key exists!
EXAMPLE 3
Output:
Found
EXAMPLE 4
Output:
Key exists!
Next TopicPhp-array-key-first-function