note 92390 rejected from language.operators.precedence by danbrown
| From: | danbrown@php.net | Date: | Wed, 22 Jul 2009 20:53:44 +0000 |
| Subject: | note 92390 rejected from language.operators.precedence by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-158592@lists.php.net to get a copy of this message | ||
Note Submitter: An M anmichel at eserviciosat dot net
----
This table isn't totally right:
The manual reads: <<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 reads:
operator -> precedence
----------------------------
&& -> left
and -> left
I believe && 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)