note 120165 added to function.empty
| From: | shuvo dot debnath at gmail dot com | Date: | Tue, 15 Nov 2016 03:36:41 +0000 |
| Subject: | note 120165 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-207104@lists.php.net to get a copy of this message | ||
Note that empty() is flakey when trying to evaluate an attribute of an StdClass. It is probably a
timing issue.
<?php
$user = new StdClass();
$user->country = "Australia";
$results = empty($user->country);
var_dump($results);
//output can vary between: bool(false) and bool(true) if you run it multiple times and vary up the
values in $user->country.
----
Server IP: 72.52.91.14
Probable Submitter: 61.69.84.230
----
Manual Page -- http://php.net/manual/en/function.empty.php
Edit -- https://master.php.net/note/edit/120165
Del: integrated -- https://master.php.net/note/delete/120165/integrated
Del: useless -- https://master.php.net/note/delete/120165/useless
Del: bad code -- https://master.php.net/note/delete/120165/bad+code
Del: spam -- https://master.php.net/note/delete/120165/spam
Del: non-english -- https://master.php.net/note/delete/120165/non-english
Del: in docs -- https://master.php.net/note/delete/120165/in+docs
Del: other reasons-- https://master.php.net/note/delete/120165
Reject -- https://master.php.net/note/reject/120165
Search -- https://master.php.net/manage/user-notes.php