note 92150 added to function.empty

From: Date: Sat, 11 Jul 2009 02:46:34 +0000
Subject: note 92150 added to function.empty
Groups: php.notes 
Request: Send a blank email to php-notes+get-158178@lists.php.net to get a copy of this message
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. ---- Server IP: 209.41.74.194 Probable Submitter: 67.237.228.46 ---- Manual Page -- http://www.php.net/manual/en/function.empty.php Edit -- https://master.php.net/note/edit/92150 Del: integrated -- https://master.php.net/note/delete/92150/integrated Del: useless -- https://master.php.net/note/delete/92150/useless Del: bad code -- https://master.php.net/note/delete/92150/bad+code Del: spam -- https://master.php.net/note/delete/92150/spam Del: non-english -- https://master.php.net/note/delete/92150/non-english Del: in docs -- https://master.php.net/note/delete/92150/in+docs Del: other reasons-- https://master.php.net/note/delete/92150 Reject -- https://master.php.net/note/reject/92150 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158178) next »