
1 xuxu 2015 年 6 月 8 日 $foo没定义时 if($foo) 会报warning. |
2 manhere 2015 年 6 月 8 日 $foo = 0; |
3 Ison 2015 年 6 月 8 日 var_dump |
4 fangjinmin 2015 年 6 月 8 日 不一样,看函数定义吧。empty对于0, "", 0.0, "0", array(), NULL, FALSE, 没赋值的$var都认为是TRUE. |
5 oott123 2015 年 6 月 8 日 > No warning is generated if the variable does not exist. That means empty() is essentially the concise equivalent to !isset($var) || $var == false. via http://php.net/manual/en/function.empty.php 也就是说,在 $var 未定义的时候不等效。 |
6 bombless 2015 年 6 月 8 日 应该是 if(isset($foo) && $foo) |
7 wavingclear 2015 年 6 月 9 日 @bombless 1楼是对的 isset 和 empty 同是语言结构,所以那样写没啥意义…… |
8 cevincheung 2015 年 6 月 9 日 @xuxu notice |