|
| HOW TO USE THE isset() FUNCTION IN PHP
The isset() function is used to check whether a variable is set or not. Returns true if it is and false if it is not. Please note the the isset() function only works on variables and it's use on anything else will produce errors.
Example Usage:
<?
$username="makemyday";
if(isset($username))
{
echo "This variable is set";
}
else
{
echo "This variable is not set";
}
?>
The above will output This variable is set as the variable is indeed set.
Even if a variable stores an empty string as follows, it will still be set.
<?
$username='';
if(isset($username))
{
echo "This variable is set";
}
else
{
echo "This variable is not set";
}
?>
The above will also output This variable is set
|
|