empty

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.

  1 
  2 $var = 0;
  3 if (empty($var)) { #evaluates true 
  4     print '$var is either 0 or not at all set';
  5 }
  6 if (!isset($var)) { // evaluates false
  7     print 'The $var is not set at all';
  8 }
  9       

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().