The usage of the three functions for PHP (), Isset () and Is_null () has been discussed a lot, and a lot of data may not be clear. Here again, but not from the concept, the direct use of program examples to speak, it should be more profound memory.
The types of tests are as follows:
Copy the Code code as follows:
$a;
$b = false;
$c = ";
$d = 0;
$e = null;
$f = Array ();
?>
Empty ()
The first is the empty var_dump output:
Copy the Code code as follows:
Var_dump (Empty ($a));
Var_dump (Empty ($b));
Var_dump (Empty ($c));
Var_dump (Empty ($d));
Var_dump (Empty ($e));
Var_dump (Empty ($f));
?>
The program output is:
BOOL (TRUE)
BOOL (TRUE)
BOOL (TRUE)
BOOL (TRUE)
BOOL (TRUE)
BOOL (TRUE)
As you can see from the code, empty () outputs true as long as the data type is empty or false.
Isset ()
And look at the output of Isset:
Var_dump (Isset ($a));
Var_dump (Isset ($b));
Var_dump (Isset ($c));
Var_dump (Isset ($d));
Var_dump (Isset ($e));
Var_dump (Isset ($f));
Output
BOOL (FALSE)
BOOL (TRUE)
BOOL (TRUE)
BOOL (TRUE)
BOOL (FALSE)
BOOL (TRUE)
You can see that isset () can only be used to determine if it is null and undefined.
Is_null ()
Finally, the output of the Is_null:
Var_dump (Is_null ($a));
Var_dump (Is_null ($b));
Var_dump (Is_null ($c));
Var_dump (Is_null ($d));
Var_dump (Is_null ($e));
Var_dump (Is_null ($f));
Output
BOOL (TRUE)
BOOL (FALSE)
BOOL (FALSE)
BOOL (FALSE)
BOOL (TRUE)
BOOL (FALSE)
Is_null literally means it.
This shows that empty () can be used to determine whether all data types are empty or false, and is_null is basically the same as isset, and can only be used to determine if null and undefined.
http://www.bkjia.com/PHPjc/327436.html www.bkjia.com true http://www.bkjia.com/PHPjc/327436.html techarticle The usage of the three functions for PHP (), Isset () and Is_null () has been discussed a lot, and a lot of data may not be clear. Repeat here, but not ...