note 92389 rejected from language.operators by danbrown
| From: | danbrown@php.net | Date: | Wed, 22 Jul 2009 20:53:55 +0000 |
| Subject: | note 92389 rejected from language.operators by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-158593@lists.php.net to get a copy of this message | ||
Note Submitter: An M anmichel at gmail dot com
----
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)