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 
    print '$var is either 0 or not at all set';
}
if (!isset($var)) { // evaluates false
    print 'The $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().