note 120165 rejected from function.empty by cmb
| From: | cmb@php.net | Date: | Tue, 15 Nov 2016 11:14:11 +0000 |
| Subject: | note 120165 rejected from function.empty by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207107@lists.php.net to get a copy of this message | ||
Note Submitter: shuvo dot debnath at gmail dot com
----
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.