Original address: http://ivhong.com/?p=110 (ivhong.com is the main address of my blog)
First take a look at the following code. What do you think the result is?
//定义一个数组, > 5.4 $arr = ['a' => null]; var_dump(isset($arr), array_key_exists('a', $arr));
---------------------Here are the results---------------------- -------
/* * 输出 *bool(false) *bool(true) */ //isset 的用法是: 检测变量是否设置,并且不是 NULL。所以会有上面的输出 //如果判断数组中是否存在某个键值,还是乖乖的用 array_key_exists 吧,不然就是给自己挖了一个巨隐藏的坑啊!!!
The above introduces the difference between php isset and array_key_exists to check whether a certain value exists in the array, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.