note 80433 added to language.types.boolean
| From: | Steve at osu1 dot php dot net | Date: | Tue, 15 Jan 2008 23:00:21 +0000 |
| Subject: | note 80433 added to language.types.boolean | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135126@lists.php.net to get a copy of this message | ||
PHP does not break any rules with the values of true and false. The value false is not a constant
for the number 0, it is a boolean value that indicates false. The value true is also not a constant
for 1, it is a special boolean value that indicates true. It just happens to cast to integer 1 when
you print it or use it in an expression, but it's not the same as a constant for the integer
value 1 and you shouldn't use it as one. Notice what it says at the top of the page:
A boolean expresses a truth value.
It does not say "a boolean expresses a 0 or 1".
It's true that symbolic constants are specifically designed to always and only reference their
constant value. But booleans are not symbolic constants, they are values. If you're trying to
add 2 boolean values you might have other problems in your application.
----
Server IP: 69.147.83.197
Probable Submitter: 72.25.179.134
----
Manual Page -- http://www.php.net/manual/en/language.types.boolean.php
Edit -- https://master.php.net/note/edit/80433
Del: integrated -- https://master.php.net/note/delete/80433/integrated
Del: useless -- https://master.php.net/note/delete/80433/useless
Del: bad code -- https://master.php.net/note/delete/80433/bad+code
Del: spam -- https://master.php.net/note/delete/80433/spam
Del: non-english -- https://master.php.net/note/delete/80433/non-english
Del: in docs -- https://master.php.net/note/delete/80433/in+docs
Del: other reasons-- https://master.php.net/note/delete/80433
Reject -- https://master.php.net/note/reject/80433
Search -- https://master.php.net/manage/user-notes.php