note 92389 added to language.operators
| From: | AnManmichel at gmail dot com | Date: | Wed, 22 Jul 2009 20:01:42 +0000 |
| Subject: | note 92389 added to language.operators | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158589@lists.php.net to get a copy of this message | ||
This doesn't have any sense:
The reason for the two different variations of "and" and "or" operators is that
they operate at different precedences. (See Operator Precedence.)
After you see at the "Operator Precedence table" one sees that:
operator -> precedence
----------------------------
&& -> left
and -> left
i think && should have right precedence, please see the following example
$ php -a
Interactive shell
php > $a = true and false;
php > var_dump($a);
bool(true)
php > $a = true && false;
php > var_dump($a);
bool(false)
php > $a = (true and false);
php > var_dump($a);
bool(false)
----
Server IP: 200.35.200.6
Probable Submitter: 190.201.79.218
----
Manual Page -- http://www.php.net/manual/en/language.operators.php
Edit -- https://master.php.net/note/edit/92389
Del: integrated -- https://master.php.net/note/delete/92389/integrated
Del: useless -- https://master.php.net/note/delete/92389/useless
Del: bad code -- https://master.php.net/note/delete/92389/bad+code
Del: spam -- https://master.php.net/note/delete/92389/spam
Del: non-english -- https://master.php.net/note/delete/92389/non-english
Del: in docs -- https://master.php.net/note/delete/92389/in+docs
Del: other reasons-- https://master.php.net/note/delete/92389
Reject -- https://master.php.net/note/reject/92389
Search -- https://master.php.net/manage/user-notes.php