How to determine whether a variable is set in PHP

Leave a Comment


  • You can use isset() method to determine whether a variable is set.
  • Returns true if variable exists, false otherwise.


Syntax
Bool isset(mixed $var[,mixed $var…])

Example
</php
$str = “Hello World”;
If(isset($str))
{
  echo “variable is set.”;
}
else
{
  echo “variable is not set.”;
}
?>

0 comments:

Post a Comment