PHP data type NULL type
Empty means null in English, which means nothing. Null is not false, not 0, and not a space.
[Key points] Know the three situations when null occurs, and learn the difference between empty and isset functions.
There are three main situations that will produce a null type:
1. The value of the variable is clearly specified as NULL through variable assignment
2. A variable has no Give any value
3. Use the function unset() to destroy the variable
Let’s demonstrate it with code.
Next we will explain two functions related to null. These two functions are very commonly used. We define the level as [default level].
empty() can pass a variable into the middle of the brackets. If the value of this variable is false or null, it returns true.
The above experiment proves that $apple is null. Place the apple in the middle of empty. The result is a true interval.
isset() can pass one or more variables between the brackets, separated by commas. As long as there is a variable that is null, it returns false. Otherwise, returns true.
unset() The function of this function is to destroy variables. Insert the variable name you want to destroy between the unset (variable) brackets, and the variable will be destroyed.
English description
unset
Pronunciation: [ʌn'set]
Explanation: Restoration