The article mainly talks about some examples about using isset with caution in PHP to determine whether there is a key in the array.
Connected to the code, I don’t know if it’s a problem with the php5.4 version, or if it’s just like this...
The code is as follows
代码如下 |
复制代码 |
$a['hello'] = ’123‘;
$a['xx'] = NULL;
var_dump(isset($a['hello'])); //bool(true)
var_dump(isset($a['xx'])); //bool(false)
# 应该使用这个来判断
var_dump(array_key_exists(‘xx’, $a)); //bool(true)
|
|
Copy code |
|
$a['hello'] = ’123‘;
$a['xx'] = NULL;
var_dump(isset($a['hello'])); //bool(true)
var_dump(isset($a['xx'])); //bool(false)
# This should be used to judge
var_dump(array_key_exists(‘xx’, $a)); //bool(true)
http://www.bkjia.com/PHPjc/628694.htmlwww.bkjia.comtrue
http: //www.bkjia.com/PHPjc/628694.htmlThe article mainly talks about some examples about using isset with caution in PHP to determine whether there is a key in the array. Connected to the code, I don’t know if it’s a problem with the php5.4 version or it’s always like this. The code is as follows. Copy...