Use the following procedure to detect
$a =0;if (empty ($a)) {echo "yes|";} Else{echo "no|";} if (Isset ($a)) {echo "yes|";} Else{echo "no|";} if (Is_null ($a)) {echo "yes|";} Else{echo "no|";} if ($a) {echo "yes|";} else {echo "no|";}
So the result of a $ A difference is as follows
Summarize:
The case of empty
The value of the 1 variable is empty $var = "";
The value of the 2 variable is a string of 0 or the number 0 $var = 0; or $var = "0″
The value of the 3 variable is flase $var = flase;
4 Null is empty
5 Empty array $arr =array ();
The 6 variable only defines $var that are not assigned value;
the situation of Isset
See if a variable is already set and not empty (determine if a variable is set and are NOT NULL)
Is_null
Determine null
Judging whether it is false
The value of the 1 variable is empty $var = "";
The value of the 2 variable is a string of 0 or the number 0 $var = 0; or $var = "0″
The value of the 3 variable is flase $var = flase;
4 Null is empty
5 Empty array $arr =array ();
The 6 variable only defines $var that are not assigned value;
These whole fake
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Summary of Php:empty,isset,is_null,array (0), array (), Array (""), 0, "0", "", "null", NULL