note 80782 deleted from function.empty by cmb
| From: | cmb@php.net | Date: | Sun, 01 Dec 2019 09:21:54 +0000 |
| Subject: | note 80782 deleted from function.empty by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213355@lists.php.net to get a copy of this message | ||
Note Submitter: Andrea Giammarchi
----
In addiction to Ed comment:
http://uk.php.net/manual/en/function.empty.php#80106
if an instance variable is assigned with an empty value, i.e. false, empty returns true.
<?php
class TestEmpty{
protected $empty;
public function __construct(){
var_dump(empty($this->empty)); // true
$this->empty = false;
var_dump(empty($this->empty)); // true
}
}
new TestEmpty;
?>
I think this is an expected behaviour but at the same time the note about classes variables is too
ambiguous.
''var $var; (a variable declared, but without a value in a class)''
Please change them into something like:
''var $var; (a variable undeclared or declared with an empty value in a class)''