note 91275 added to function.empty
| From: | aleczapkaatgmxdotnet at osu1 dot php dot net | Date: | Wed, 03 Jun 2009 12:48:59 +0000 |
| Subject: | note 91275 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-156319@lists.php.net to get a copy of this message | ||
The behaviour of this function is either bugged or badly documented.
Consider this input array:
Array
(
[0] => Array
(
[0] => \K6
[1] => 10
)
[1] => Array
(
[0] => 6
[1] => 12
)
)
Even though var_dump(empty($array)) will return 'boolean false', the code below will never
work.
if (!empty($array))
{
// do something - but this part will never be reached
}
This works though:
if (empty($array) !== false)
{
//do something - now this works
}
----
Server IP: 194.24.174.37
Probable Submitter: 89.25.186.114
----
Manual Page -- http://www.php.net/manual/en/function.empty.php
Edit -- https://master.php.net/note/edit/91275
Del: integrated -- https://master.php.net/note/delete/91275/integrated
Del: useless -- https://master.php.net/note/delete/91275/useless
Del: bad code -- https://master.php.net/note/delete/91275/bad+code
Del: spam -- https://master.php.net/note/delete/91275/spam
Del: non-english -- https://master.php.net/note/delete/91275/non-english
Del: in docs -- https://master.php.net/note/delete/91275/in+docs
Del: other reasons-- https://master.php.net/note/delete/91275
Reject -- https://master.php.net/note/reject/91275
Search -- https://master.php.net/manage/user-notes.php