您现在的位置是:首页 > PHP技术PHP技术
php变量布尔值验证详细参考
2018-03-20【PHP技术】2195 人已围观
简介使用 PHP 函数对变量$x进行比较表达式gettype()empty()is_null()isset()boolean:&...
表达式 | 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 |
以上是平时开发中的注意事项,有疑问的大家可以验证下哈欢迎指正
细节才是最重要的!
关注宁波网站建设博客,更多精彩分享,敬请期待!
Tags:
很赞哦! ()
相关文章
随机图文
Thinkphp3.1.3中的redirect详解
页面跳转是php编程中常用的方法,今天说说thinkphp3.1.3中的redirect.tp跳转有success和error这二个参数有...mysql常见的多表查询语句
select*fromTable1,Table2whereTable1.id=1andTbale2.id-2(是某一相同字段)注意这样的查询...网站安全代码thinkphp3.1密码强度检测
/** *检查密码复杂度 */ publicfunctioncheckPassword($pwd){ if($pwd==null){...thinkphp模板中数组的输出
thinkphp的数组在模版输出是频率很高的操作. 我在后action内一般是把数据都绑定到变量内,当然是以数组的形式.select后的操作...