isset
(PHP 3, PHP 4, PHP 5)
isset -- Check whether the variable is set
Description
bool isset ( mixed var [, mixed var [, ...]])
Returns TRUE if var exists, FALSE otherwise.
If a variable has been released using unset(), it will no longer be isset(). If you use isset() to test a variable that is set to NULL, it will return FALSE. Also note that a NULL byte ("
Warning: isset() can only be used with variables, as passing any other arguments will cause a parsing error. If you want to check whether a constant has been set, use the defined() function.if (isset($var)) {
print "This var is set set so I will print.";
}
$a = "test";
$b = "anothertest";
var_dump( isset ($a, $b) ); // TRUE
var_dump( isset ($a) ); // FALSE
var_dump( isset ($a, $b) ); // FALSE
var_dump( isset ($foo) ); // FALSE
?>
// The value of key 'hello' is equal to NULL, so it is considered unset.
// If you want to detect NULL key values, you can try the method below.
?>
Note: Since this is a language structure rather than a function, it cannot be "Variable function" call.
Format: bool isset ( mixed var [, mixed var [, ...]] )
Function: Detect whether a variable is set
If the variable does not exist, it returns FALSE
If the variable exists and its value is NULL, it also returns FALSE
If the variable exists and its value is not NULL, it returns TURE
When checking multiple variables at the same time, TRUE will be returned only when each single item meets the previous requirement, otherwise the result will be FALSE
More instructions:
After a variable is released using unset(), it will no longer be isset().
The PHP function isset() can only be used for variables. Passing any other parameters will cause a parsing error.
To check whether a constant has been set, use the defined() function.
unset()
Destroy the specified variable. Note that in PHP 3, unset() will return TRUE (actually the integer value 1), while in PHP 4, unset() is no longer a real function: it is now a statement. There is no return value, and trying to get the return value of unset() will result in a parsing error.
http://www.bkjia.com/PHPjc/740215.html