php中的null、empty、与“”
来源:互联网 发布:php中输入html 编辑:程序博客网 时间:2024/05/22 09:43
null
The special NULL value represents a variable with no value. NULL is the only possible value of type NULL.
//特殊的NULL值给出一个没有值的变量。NULL是NULL类型的唯一可能值。
A variable is considered to be null if:
//一个变量如果在下列情况被认为是NULL:
it has been assigned the constant NULL.
//它被指定为NULL常量。
it has not been set to any value yet.
//它还没有被赋予任何值。
it has been unset().
//它被销毁了。
empty
bool empty ( mixed $var )
判断是否一个变量被认为是空的。返回布尔值.
它是一个函数。
empty() only checks variables as anything else will result in a parse error. In other words, the following will not work: empty(trim($name)).
它仅检查变量,其它任何表达做为$var值都会解析错误。换句话说,这种表达式不会起作用,如:empty(trim($name))
empty() is the opposite of (boolean) var, except that no warning is generated when the variable is not set.
它给出与$var值相反的boole(是或否)类型的值,仅当$var没有被设置的时候,它才不给提示。
Return Values//返回值
Returns FALSE if var has a non-empty and non-zero value.
//返回FALSE,如果$var是一个非空或非0值;
The following things are considered to be empty:
//下列情形即被认为empty成立:
" " (an empty string)
// " "空字符串;
0 (0 as an integer)
// 整数0;
0.0 (0 as a float)
// 浮点型0;
"0" (0 as a string)
//字符串0;
NULL
// null值;
FALSE
// false值;
array() (an empty array)
//空数组;
var $var; (a variable declared, but without a value in a class)
//在一个类中,变量被声明了,但是并没有一个值;
综上,在php看来,上述情况都被empty函数判定为true,包括null;
但事实上,null多表示什么都没有,没对象,没变量,没值;而如果给变量一个" "值,则代表变量已经是一个字符串,只是没有具体值。所以php中empty的外延相当大。数字0也被判定empty;
- php中的null、empty、与“”
- Java集合中的Empty与null
- null与empty区别
- VBScript 中的 Empty, Null, "" 讨论
- NULL与String.Empty的
- PHP中的empty()函数
- PHP isset 与 empty
- php中isset()与empty的区别以及与0,NULL,FALSE的关系
- php中null 0 empty "" 区别
- C#中的DBNull、Null、String.Empty和“”
- EL表达式中的empty和null
- string.Empty 与 null 的区别
- string.Empty与null的区别
- PHP 中的isset和empty
- PHP中的字符串、isset、empty
- PHP 中的isset empty区别
- php empty 与 isset 区别
- PHP isset()与empty()详解
- Python:通过获取淘宝账号和密码的实验,来看登陆方式选择的重要性(二)
- PHP中的GBK与UTF-8等字符串编码形式的自由转换工具iconv
- 详解rsync算法--如何减少同步文件时的网络传输量
- linux内核里面writel是如何实现的?
- PHP中的$argv 与超全局变量
- php中的null、empty、与“”
- ZOJ 2859 二维RMQ
- s3c2440 devices usb改为host usb 小记
- 利用HtmlParse抽取网页正文内容
- Add SVN plug-in for Carbide C++
- php中的url解析
- php中数组与字符串的互转
- discuz安装教程
- 2012 年开发者应该做的11件事