note 92150 deleted from function.empty by danbrown

From: Date: Sat, 11 Jul 2009 02:47:53 +0000
Subject: note 92150 deleted from function.empty by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-158179@lists.php.net to get a copy of this message
Note Submitter: Strata_ranger ---- There is one caveat to mlibazisi mabandla's example: If you attempt to call that function on an unset variable it will throw an E_NOTICE as you call it because the variable gets evaluated before it is passed to the function. As such, there are no easy substitutions for making a string '0' be silently considered non-empty. As Greg Hartwig mentioned last year, empty($var) for most casual purposes has the same effect as (!$var), with the difference that the latter will throw an E_NOTICE on unset variables whereas empty() will silently return false.

« previous php.notes (#158179) next »