Current Location: Home> Function Categories> isset

isset

Detect whether the variable is set and is not null
Name:isset
Category:Variable processing
Programming Language:php
One-line Description:Checks whether the variable is set (declared and not NULL).

Definition and usage

isset() function checks if the variable is set, which means that the variable must be declared and not NULL .

If the variable exists and is not NULL , the function returns true , otherwise false .

Note: If multiple variables are provided, this function returns true only if all variables are set.

Tip: You can use unset() function to unset variables.

Example

Check if the variable is empty. Also check if the variable is set/declared:

 <?php
$a = 0 ;
// True because $a is set
if ( isset ( $a ) ) {
  echo "Variable 'a' is set.<br>" ;
}

$b = null ;
// False because $b is NULL
if ( isset ( $b ) ) {
  echo "Variable 'b' is set." ;
}
?>

Try it yourself

grammar

 isset ( variable , ... . ) ;
parameter describe
variable Required. Specifies the variable to check.
... Optional. Another variable to check.
Similar Functions
Popular Articles