且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如果我将NULL赋给变量,isset()是否会返回false?

更新时间:2023-11-28 10:28:34

bool isset ( mixed $var [, mixed $var [, $... ]] )

确定是否设置了变量并且该变量不为NULL.

Determine if a variable is set and is not NULL.

如果已使用unset()取消设置了变量,则将不再设置该变量.如果测试已设置为NULL的变量, isset()将返回FALSE .另外请注意,NULL字节(\ 0)不等于PHP NULL常量.

If a variable has been unset with unset(), it will no longer be set. isset() will return FALSE if testing a variable that has been set to NULL. Also note that a NULL byte ("\0") is not equivalent to the PHP NULL constant.

返回值

如果var存在并且具有非NULL的值,则返回TRUE,否则返回FALSE.

Returns TRUE if var exists and has value other than NULL, FALSE otherwise.

来自手册.在同一页面上的示例.

From the manual. Examples on the same page.