Home >Backend Development >PHP Tutorial > is_null和empty解决思路

is_null和empty解决思路

WBOY
WBOYOriginal
2016-06-13 13:29:381192browse

is_null和empty
一个为空的array

if(is_null($array))
{
不会执行这里
}

if(empty($array))
{
会执行
}

何解?

------解决方案--------------------
空数组是有 0 个元素的数组
------解决方案--------------------
empty在变量为null,0,"",'0',null,array()返回true 
isset在判断null时返回false 
is_null只要是null返回true,否则返回false

Statement:
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