During the development of empty () and isset () functions in PHP, it is often possible to determine whether the variable does not exist or whether it is null, especially the array, if an element that does not exist in the access array, there will be a Notice-level error, which is also a result of not rigorous logic.
First, let's take a look at the empty () function:
Determines whether a function is null. In PHP, what kind of situation is considered empty?The first is that this variable does not exist.;The second is that the value of this variable is equivalent to FALSE.. That is to say, empty ($ var) is equivalent! Isset ($ var) | $ var = FALSE.
Let's take a look at the isset () function:
Judge a variableExistAndThe value is not NULL..
If unset ($ var) is used, $ var does not exist;
If a variable is NULL, the function returns FALSE;
In addition, this function can have multiple parameters. TRUE is returned only when all parameters exist and the value is not equal to NULL.
Because NULL is also a value equivalent to FALSE, the emtpy () function equals isset () and determines whether the variable is equal to other values equivalent to FALSE.