【函数功能】
该函数用于检查指定变量是否为空,若为空则返回true,否则返回false。
【函数语法】
empty ($var)
【参数说明】
$var:必需,需要传入的值。
【演示程序】
<?php
/**
* empty ($var)
* **/
$a = "";
var_dump(empty($a));
$a = "0";
var_dump(empty($a));
?>
【输出结果】
bool(true) bool(true)
【特别注意】
1.该函数是一个语言结构,而非一个真正的函数。
2.该函数只能检查变量,传入非变量会报错。
3.当变量值为空或0时该函数都返回true。
4.PHP版本:PHP4+。
【原版定义】
Determine whether a variable is considered to be empty.
A variable is considered empty if it does not exist or if its value equals FALSE.
empty() does not generate a warning if the variable does not exist.
转载请注明出处:php1234.cn ,原文地址:http://www.php1234.cn/a/functions/2017/0607/229.html