Differences between isset and array_key_exists in PHP functions. The isset and array_key_exists methods are generally used to determine whether the index value of a PHP array exists. Isset ($ a [key]) array_key_exists (key, $ a) array_key_exists is used to determine whether the index value of a PHP array exists.
issetAnd
array_key_existsTwo methods.
isset($a['key'])array_key_exists('key', $a)
array_key_existsTo tell you exactly whether an array has a keyissetOnly whether the return key value isnull. That is to say, assume that the following array is given:
$a = array('key1' => '123', 'key2' => null);
Use these two methods to determine the existence of the key value:
isset($a['key1']); // truearray_key_exists('key1', $a); // trueisset($a['key2']); // falsearray_key_exists('key2', $a); // true
From the PHP engine itself, the underlying layer is implemented in C language,array_key_existsAndissetIt should be fast. If the number of operations is more than timesissetPerformance should be more significant.
If the index value of the sort PHP array exists, the isset and array_key_exists methods are generally used. Isset ($ a ['key']) array_key_exists ('key', $ a) array_key_exists exact...