PHP isset() method is used to check the variable or array or object’s property is exists or not. It gives output in a boolean value. if the variable or array element or object’s property exists then the output will be true or 1 and if the variable or array or object’s property does not exist then the output will be false or 0.
Syntax:- to check the variable
<?php
isset($variable_name)
?>
Example:- Suppose, You have employee_name variable which has value John and now you want to check employee_name variable is exists or not.
<?php
$employee_name="John";
if(isset($employee_name))
{
echo $employee_name.' is exists';
}
?>
Output:- John is exists
Example2:- Suppose, You check employee_age exists or not
<?php
if(isset($employee_age))
{
echo $employee_age.' is exists';
}else{
echo 'employee age does not exist';
}
?>
Output:- employee age does not exist