Join Up!
104886 members and counting!

 
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links 
search for in the  
previousdoublevalfloatvalnext
Last updated: Sun, 27 Oct 2002
view the printer friendly version or the printer friendly version with notes or change language to Finnish | German | Spanish

empty

(PHP 3, PHP 4 )

empty -- Determine whether a variable is set

Description

boolean empty ( mixed var)

Poznámka: empty() is a language construct.

This is the opposite of (boolean) var, except that no warning is generated when the variable is not set. See converting to boolean for more information.

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

User Contributed Notes
empty
add a note about notes
There are no user contributed notes for this page.
previousdoublevalfloatvalnext
Last updated: Sun, 27 Oct 2002
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by: http://phpbuilder.com/
Last updated: Thu Oct 31 18:34:28 2002 EST