Tested:
If (isset ($ array [$ I]) {echo "exists ";}
If (array_key_exists ($ I, $ array) {echo "exists ";}
When the number of arrays is 10, the difference between the two is shown that the isset speed is nearly 10 times faster, but it is not very obvious, and there is not much difference between the two for the existence of variables, it runs faster when a variable exists, but this trend is very weak.
When array_key_exists is used, as the number of cycles increases, the program running time increases by a geometric level. When the number of elements in an array exceeds 1000, the operation speed is very slow.
Therefore, isset and array_key_exists determine whether an element in an array function exists. The isset speed is faster, and the speed difference is very large.
Because isset belongs to the language structure in php, and array_key_exists is a function, isset is faster. In addition, isset also exists in other languages and is more readable.
In addition, when the variable value is NULL, isset returns false, while array_key_exists only determines whether the variable exists. Therefore, if you determine an element in an array and whether it is true, you should use isset.