note 84268 deleted from language.operators.logical by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 15:14:28 +0000 |
| Subject: | note 84268 deleted from language.operators.logical by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189837@lists.php.net to get a copy of this message | ||
Note Submitter: jeffjeffleelee at hotmail dot com
----
@zhustar:
I will verify the following:
<?php
$a = false xor true;
var_dump($a); // bool(false)
$a = (false xor true);
var_dump($a); // bool(true)
?>
At first I thought this was some egregious bug, and then I realized that this is merely an issue of
operator precedence. English-word boolean operators have relatively low precedence--in fact they
take place after assignment. So the first example assigns false to $a, and then does an xor
operation on $a and boolean true.