Home >Backend Development >PHP Tutorial >What is the difference between empty and is_null? _PHP Tutorial

What is the difference between empty and is_null? _PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:54:56863browse

What is the difference between empty and is_null?

bool empty ( mixed $var )

If var is a non-empty or non-zero value, empty() returns FALSE. In other words, "", 0, "0", NULL, FALSE, array(), var $var; and objects without any properties will be considered empty, and TRUE is returned if var is empty.

empty() is the antonym of (boolean) var except that it does not produce a warning when the variable is not set. See Converting to Boolean for more information.
///////////////////////////////////////////////////// ///////////////////////////////////////////
A variable is considered NULL in the following situations:

bool is_null ( mixed $var )

Returns TRUE if var is null, FALSE otherwise.


is assigned the value NULL.

has not been assigned a value yet.

is unset().

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632272.htmlTechArticleWhat is the difference between empty and is_null? bool empty ( mixed $var ) empty() returns FALSE if var is a non-empty or non-zero value. In other words, 0, 0, NULL, FALSE, array(), va...
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