老李头 发布的文章

empty判断各种特殊表达式是否为空的使用方法:

$a='';
$b=NULL;
$c=0;
$d=-1;
$e=false;
$f=true;
 
echo 'a is empty:'.empty($a).'<br/>';
echo 'b is empty:'.empty($b).'<br/>';
echo 'c is empty:'.empty($c).'<br/>';
echo 'd is empty:'.empty($d).'<br/>';
echo 'e is empty:'.empty($e).'<br/>';
echo 'f is empty:'.empty($f).'<br/>';

输出结果:

a is empty:1
b is empty:1
c is empty:1
d is empty:
e is empty:1
f is empty: