Home > php教程 > php手册 > php中慎用isset来判断数组是否存在key

php中慎用isset来判断数组是否存在key

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:17:00
Original
1611 people have browsed it

文章主要讲到关于php中慎用isset来判断数组是否存在key一些举例说明。

接上代码,  不知道是php5.4版本的问题, 还是本来就这样…

 代码如下 复制代码

$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)

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template