reproduced:http://www.cnblogs.com/ndxsdhy/archive/2011/04/02/2003193.html1.isset () function
generally used to detect whether a variable is set (whether it has been assigned)
1.1. Returns FALSE if the variable does not exist
1.2. Returns FALSE if the variable exists and its value is null
1.3. Returns TURE if the variable exists and the value is not NULL
1.4. You can also check multiple variables at the same time, return TRUE if each item meets the previous requirement, otherwise the result is FALSE
After you use Unset () to release a variable, it will no longer be isset ().
PHP Functions Isset () can only be used for variables, and passing any other parameter will result in parsing errors.
detects if a constant is set to use the defined () function.
2.empty () function
The judgment value is no null
2.1. Returns TRUE if the variable does not exist
2.2. If the variable exists and its value is "", 0, "0", NULL,, FALSE, Array (), Var $var; and objects that do not have any properties, the TURE is returned.
2.3. If the variable exists and the value is not "", 0, "0", NULL, FALSE, Array (), Var $var; And an object that does not have any properties, it returns FALSE
The return value of empty () =! (Boolean) Var, but does not produce a warning message because the variable is undefined. See Convert to Boolean for more information.
Empty () can only be used for variables, and passing any other parameter will cause Paser error and terminate the run.
Detects if a constant is set to use the defined () function.
Example: A simple comparison of empty () with Isset ()
The code is as follows:
<?PHP$var= 0;//The result is true because the $var is emptyif(Empty($var)) {Echo' $var is either 0 or not set at all ';}//The result is false because the $var has been setif(!isset($var)) {Echo' $var is not set at all ';}?>Note:because this is a language structure and not a function, it cannot be called by a variable function. Note:Empty() detects only variables and detects anything that is non-variable will result in parsing errors. In other words, the statement behind will not work:Empty(addslashes($name))。
View Code
"
PHP isset () and empty () differences