Differences between empty, isset, and is_null in PHP
Source: Internet
Author: User
In PHP, empty, isset, and is_null are different. if the variable is not null or a non-zero value, empty () returns FALSE. In other words, "", 0, "0", NULL, FALSE, array (), var $ var, undefined; and no difference between empty, isset, and is_null in PHP
Empty
If the variable is not null or a non-zero value, empty () returns FALSE. In other words, "", 0, "0", NULL, FALSE, array (), var $ var, undefined, and objects without any attributes will be considered empty, if var is null, TRUE is returned.
Isset
If the variable exists (not NULL), TRUE is returned; otherwise, FALSE (including undefined) is returned ). If the value of a variable is set to null, false is returned. if a variable is unset, the variable is canceled. Note that isset has special processing for NULL variables.
Is_null
Checks whether the input value [value, variable, expression] is null. only if one variable is defined and its value is null, TRUE is returned. otherwise, FALSE is returned. [an error will occur after an undefined variable is passed in! ].
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.