note 124288 added to function.empty
| From: | info at ugurbicer dot com dot tr | Date: | Fri, 11 Oct 2019 19:27:18 +0000 |
| Subject: | note 124288 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-212576@lists.php.net to get a copy of this message | ||
$a = '' or '0' or false or 0 or null or what else..
<?php
$a = function(){
$arr = ['', 0, '0', false, null];
return $arr[rand(0,4)];
};
$a = $a();
if (! $a) {
var_dump($a);
}
if (empty($a)) {
var_dump($a);
}
?>
results : all passed
so, what is the difference between empty function and "!" operator?
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.168 (proxied: 176.43.222.185)
----
Manual Page -- http://php.net/manual/en/function.empty.php
Edit -- https://master.php.net/note/edit/124288
Del: integrated -- https://master.php.net/note/delete/124288/integrated
Del: useless -- https://master.php.net/note/delete/124288/useless
Del: bad code -- https://master.php.net/note/delete/124288/bad+code
Del: spam -- https://master.php.net/note/delete/124288/spam
Del: non-english -- https://master.php.net/note/delete/124288/non-english
Del: in docs -- https://master.php.net/note/delete/124288/in+docs
Del: other reasons-- https://master.php.net/note/delete/124288
Reject -- https://master.php.net/note/reject/124288
Search -- https://master.php.net/manage/user-notes.php