note 125279 deleted from function.key-exists by cmb
| From: | cmb@php.net | Date: | Tue, 18 Aug 2020 08:37:16 +0000 |
| Subject: | note 125279 deleted from function.key-exists by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-214983@lists.php.net to get a copy of this message | ||
Note Submitter: mahmoudaburascea at gmail dot com
----
key_exists() is an alias of array_key_exists() so you use it in the exact same way:
Example:
$test_array = [1, 7, 0, 2, 2, 0, 1, 1];
$test_1 = key_exists(4, $test_array);
$test_2 = array_key_exists(4, $test_array);
$test_3 = key_exists(2, $test_array);
$test_4 = array_key_exists(2, $test_array);
echo($test_1, $test_2, $test_3 $test_4);
Result:
false false true true
Pretty self-explanatory :)