Home  >  Article  >  Backend Development  >  php-isset

php-isset

WBOY
WBOYOriginal
2016-06-23 13:42:09825browse

isset函数是检测变量是否设置。 

格式:bool isset ( mixed var [, mixed var [, ...]] ) 

返回值: 

若变量不存在则返回 FALSE 
若变量存在且其值为NULL,也返回 FALSE 
若变量存在且值不为NULL,则返回 TURE 
同时检查多个变量时,每个单项都符合上一条要求时才返回 TRUE,否则结果为 FALSE 
如果已经使用 unset() 释放了一个变量之后,它将不再是 isset()。若使用 isset() 测试一个被设置成 NULL 的变量,将返回 FALSE。同时要注意的是一个 NULL 字节(”\0″)并不等同于 PHP 的 NULL 常数。

警告: isset() 只能用于变量,因为传递任何其它参数都将造成解析错误。若想检测常量是否已设置,可使用 defined() 函数。 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn