note 80782 added to function.empty
| From: | AndreaGiammarchi at osu1 dot php dot net | Date: | Thu, 31 Jan 2008 15:34:37 +0000 |
| Subject: | note 80782 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135653@lists.php.net to get a copy of this message | ||
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)''
----
Server IP: 194.145.210.3
Probable Submitter: 213.123.186.247
----
Manual Page -- http://www.php.net/manual/en/function.empty.php
Edit -- https://master.php.net/note/edit/80782
Del: integrated -- https://master.php.net/note/delete/80782/integrated
Del: useless -- https://master.php.net/note/delete/80782/useless
Del: bad code -- https://master.php.net/note/delete/80782/bad+code
Del: spam -- https://master.php.net/note/delete/80782/spam
Del: non-english -- https://master.php.net/note/delete/80782/non-english
Del: in docs -- https://master.php.net/note/delete/80782/in+docs
Del: other reasons-- https://master.php.net/note/delete/80782
Reject -- https://master.php.net/note/reject/80782
Search -- https://master.php.net/manage/user-notes.php