The empty() function is used to determine whether a variable is considered to be empty. A variable is considered empty if it does not exist, or if its value is equal to false, 0, an empty string '', NULL, an empty array, or an object with no properties.

The empty() function returns true if the variable is empty, and false otherwise.

$var1 = '';      // empty string
$var2 = 0;       // zero
$var3 = null;    // NULL
$var4 = false;   // false
$var5 = array(); // empty array

if (empty($var1)) {
    echo "Variable 1 is empty.\n";
}

if (empty($var2)) {
    echo "Variable 2 is empty.\n";
}

if (empty($var3)) {
    echo "Variable 3 is empty.\n";
}

if (empty($var4)) {
    echo "Variable 4 is empty.\n";
}

if (empty($var5)) {
    echo "Variable 5 is empty.\n";
}

Output:

Variable 1 is empty.
Variable 2 is empty.
Variable 3 is empty.
Variable 4 is empty.
Variable 5 is empty.

 

In this example, 

all variables $var1 through $var5 are considered empty according to the empty() function's definition, so all conditions evaluate to true and the corresponding messages are echoed.