Is_null, empty, isset, unset Let's take a look at the descriptions of these 4 functions first.
Isset determine if a variable already exists (configuration)
unset to remove (release) a variable
Empty determine if the variable is empty
Is_null determine if the variable is null
OK, it's starting to get people started. So start, the 4 functions except unset, the other 3 are the Judge function, unset first out, because he will not be mistaken, followed by is_null, we can see it as a!isset, is the isset of a reverse operation, the following table can be very clear description of their relationship:
Copy Code code as follows:
Variable Empty is_null isset
$a = "" True false
$a =null true False
var $a true true false
$a =array () True False
$a =false True
$a =15 to False true
$a =1 to False true
$a =0 True
$a = "0" true false
$a = "true" to false true
$a = "false" to false true
From that we can see that as long as the variable is "" or 0, or false and null, as long as the value empty returns True, and Isset is the judge of whether the variable exists, as long as you are not NULL or unassigned, the return result is true, and Is_ Null is exactly the inverse result of isset.
Of course if just want to do the following work:
echo!isset ($_get[' a ']); If you don't get the value of variable a
echo Empty ($_get[' a ']); If the value of variable A is empty
So the results are the same, they can be used.