判断php变量是否定义,是否为空,是否为真的一览表
2024-08-25 03:46:03
分类:
表达式 | 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 |
最新文章
- DevExpress GridView属性说明
- Mysql 全文索引
- 数据仓库建模与ETL实践技巧
- 爬虫的自我解剖(抓取网页HtmlUnit)
- spark读取hdfs数据本地性异常
- Servlet中读取参数的几种方式
- poj 3778
- unable to create …
- Pycharm快捷键的使用
- 酷伯伯实时免费HTTP代理ip爬取(端口图片显示+document.write)
- idea配置tomcat运行按钮置灰,下拉没有自定义的tomcat选项
- 未能加载文件或程序集“System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项
- Integer类toString(int i,int radix)方法
- TeamViewer 安装
- Redux 笔记详解
- 获取TypeError:__init __()缺少1个需要的位置参数:'on_delete'当试图添加父表后面的子表
- C#字符串截取、获取当前电脑时间、判断输入日期对错 随手记
- linux系统分区表修复
- ThreadLocal模式与synchronized关键字的比较
- sql server 只读帐号设置能读取存储过程,view等内容。