Russian Ukraine English
Catalog RSS


empty

(unknown)

empty -- Determine whether a variable is set

Description

int empty (mixed var)

Returns false if var is set and has a non-empty or non-zero value; true otherwise.


$var = 0;  if (empty($var)) {  // evaluates true     echo '$var is either 0 or not set at all'; }  if (!isset($var)) { // evaluates false     echo '$var is not set at all'; }       

Note that this is meaningless when used on anything which isn't a variable; i.e. empty (addslashes ($name)) has no meaning since it would be checking whether something which isn't a variable is a variable with a false value.

See also isset() and unset().

Led