note 45009 deleted from function.empty by aidan

From: Date: Mon, 24 Jan 2005 15:02:04 +0000
Subject: note 45009 deleted from function.empty by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-83875@lists.php.net to get a copy of this message
Note Submitter: csst0266 at cs dot uoi dot gr ---- Be careful when using empty(). It takes a variable as an argument, and not a constant value. So, empty($var); would be right, while empty(trim($var)); would be wrong. This is because the trim function returns a constant string value which is passed to empty() as an argument. The second case could have been trim($var) == ''; instead. It is a common pitfall I have encountered many times, so watch out. :-)

« previous php.notes (#83875) next »