以技术为主
php中empty is_null isset 三者的区别
| Expression | gettype() | empty() | is_null() | isset() | boolean : if($x) |
|---|---|---|---|---|---|
| $x = “”; | string | TRUE | FALSE | TRUE | FALSE |
| $x = null | NULL | TRUE | TRUE | FALSE | FALSE |
| var $x; | NULL | TRUE | TRUE | FALSE | FALSE |
| $x is undefined | NULL | TRUE | TRUE | FALSE | FALSE |
| $x = array(); | array | TRUE | FALSE | TRUE | FALSE |
| $x = false; | boolean | TRUE | FALSE | TRUE | FALSE |
| $x = true; | boolean | FALSE | FALSE | TRUE | TRUE |
| $x = 1; | integer | FALSE | FALSE | TRUE | TRUE |
| $x = 42; | integer | FALSE | FALSE | TRUE | TRUE |
| $x = 0; | integer | TRUE | FALSE | TRUE | FALSE |
| $x = -1; | integer | FALSE | FALSE | TRUE | TRUE |
| $x = “1″; | string | FALSE | FALSE | TRUE | TRUE |
| $x = “0″; | string | TRUE | FALSE | TRUE | FALSE |
| $x = “-1″; | string | FALSE | FALSE | TRUE | TRUE |
| $x = “php”; | string | FALSE | FALSE | TRUE | TRUE |
| $x = “true”; | string | FALSE | FALSE | TRUE | TRUE |
| $x = “false”; | string | FALSE | FALSE | TRUE | TRUE |
本文地址:http://www.yaronspace.cn/blog/index.php/archives/602
来自yaronspace.cn 本文链接:http://yaronspace.cn/blog/archives/602| 这篇文章由admin于14/05/2010 11:25发表在Php|Python。你可以订阅RSS 2.0 也可以发表评论或引用到你的网站。 |