← All built-ins / array_key_exists()
array_key_exists()
array_key_exists(...$args): bool
Parameters
| Name | Type | Description |
|---|---|---|
| $key | string|int | key to test |
| $a | array | array to test |
Return value
true when the key exists — also when its value is null (unlike isset).
Example
$m = ["k" => null];
var_dump(array_key_exists("k", $m));
var_dump(isset($m["k"]));bool(true) bool(false)