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
Release: 2016-07-13 10:54:56
Original
868 people have browsed it

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...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template