Home  >  Article  >  Backend Development  >  empty String exception prompts the difference between empty and isset

empty String exception prompts the difference between empty and isset

WBOY
WBOYOriginal
2016-07-28 08:29:562053browse

    empty is to determine whether a variable is empty. If the variable is a non-empty or 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 empty, TRUE will be returned. . (1) Number 0; (2) Empty character; (3) Variable defined as null; (4) Variable defined as false; (5) Empty array; (6) Undefined variable. )

empty will all judge that the variable is empty and return true

isset determines whether a variable is set. If the variable exists (non-NULL), it returns TRUE, otherwise it returns FALSE (including undefined). The variable value is set to: null, and the return value is also false; after unsetting a variable, the variable is canceled. Note that isset handles NULL value variables specially.

The above introduces the difference between empty String exception prompt empty and isset, including the content of empty String exception prompt. I hope it will be helpful to friends who are interested in PHP tutorials.

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