The three functions are:
Function 1: isset ():
Used to determine whether a variable has been declared by PHP. It returns a Boolean value. If the variable has been set, true is returned. If the variable is set, false is returned. If the value of the variable is set to null, false is returned. Isset can also be used to determine the elements and object attributes of an array.
Analysis: There are several unclear descriptions in this section. They start to judge whether the statement has been "declared" and then "set". Verify what it is.
TestCode:
<? PHP $ variable1 = NULL; $ variable2 = ""; $ variable3 = "0"; $ variable4 = false; $ variable5 = "test "; // $ variable6 does not declare echo "variable1 --> ". isset ($ variable1 ). "<br/>"; echo "variable2 --> ". isset ($ variable2 ). "<br/>"; echo "variable3 --> ". isset ($ variable3 ). "<br/>"; echo "variable4 --> ". isset ($ variable4 ). "<br/>"; echo "variable5 --> ". isset ($ variable5 ). "<br/>"; echo "variable6 --> ". isset ($ variable6 ). "<br/>";?>
Test results:
Variable1 --> variable2 --> 1variable3 --> 1variable4 --> 1variable5 --> 1variable6 -->
Summary: isset returns false only when the variable value is null or the variable is not declared.
Function 2: unset ():
Unset () can be used to cancel the definition of a variable previously defined, and if no other variable is referencing it, all the memory space used by this variable can be released. If you call isset () to check a variable that has been processed by unset (), false is returned.
Function 3: Empty ():
Empty () can be used to check whether a variable is declared or its value is false.