标签:
直接上代码
<?php $a=0; $b=‘0‘; $c=0.0; $d=‘‘; $e=NULL; $f=array(); $g=‘\0‘; $h=‘ ‘;//space $i=true; $j=false; $k;// a variable declared, but without a value $_arr=get_defined_vars(); array_splice($_arr,0,7); foreach($_arr as $k=>$v){ var_dump(!is_null($v)); var_dump(!empty($v)); var_dump(isset($v)); echo ‘<br/>‘; } //END
结果
boolean true boolean false boolean true boolean true boolean false boolean true boolean true boolean false boolean true boolean true boolean false boolean true boolean false boolean false boolean false boolean true boolean false boolean true boolean true boolean true boolean true boolean true boolean true boolean true boolean true boolean true boolean true boolean true boolean false boolean true
总结:
1、is_null 和 isset基本一样
2、empty() is the opposite of (boolean) var, except that no warning is generated when the variable is not set.(手册上说的)
3、$k没有获取到,那肯定is_null了
标签:
原文地址:http://www.cnblogs.com/chenpingzhao/p/4521531.html