September 2001
Intermediate to advanced
768 pages
32h 45m
English
bool empty(mixed variable) Tests whether a variable is defined and contains a non-empty and nonzero value.
Returns:
TRUE if the variable is empty or undefined; FALSE otherwise
Description:
empty() checks whether the argument passed is a defined variable that contains a value other than an empty array, empty string, 0 (zero), or NULL. empty() should be used only on variables—if the function is used on a value, it generates a parse error.
Availability:
UNIX, Windows
Version:
3+, 4+
See also:
To compare one value to another:
==, ===, !=, !==, <, >, <=, >= operators
To test whether a variable is set:
isset()
Examples:
$value = ''; if (empty ($value)) print "Variable <i>\$value</i> is empty.\n\n"; else ... |
Read now
Unlock full access