PHP isset() Function

PHP list Keyword
PHP interface Keyword

In this article, you will learn how to check if a variable is empty or not.

The isset() function checks whether a variable is set, which means that it has to be declared and is not NULL. This function returns true if the variable exists and is not NULL, otherwise it returns false.

what is the syntax of the ISSET() function in php?

isset(variable, ....);
ParameterDescription
variableRequired. Specifies the variable to check
Optional. Another variable to check
PHP isset() method

examples of the ISSET() function

Example 1. In this example, we check whether a variable is empty. Also, check whether 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.";
}
?>
PHP list Keyword
PHP interface Keyword

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top