note 84268 added to language.operators.logical
| From: | jeffjeffleelee at hotmail dot com | Date: | Mon, 07 Jul 2008 04:30:34 +0000 |
| Subject: | note 84268 added to language.operators.logical | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141221@lists.php.net to get a copy of this message | ||
@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.
----
Server IP: 69.147.83.197
Probable Submitter: 75.80.31.52
----
Manual Page -- http://www.php.net/manual/en/language.operators.logical.php
Edit -- https://master.php.net/note/edit/84268
Del: integrated -- https://master.php.net/note/delete/84268/integrated
Del: useless -- https://master.php.net/note/delete/84268/useless
Del: bad code -- https://master.php.net/note/delete/84268/bad+code
Del: spam -- https://master.php.net/note/delete/84268/spam
Del: non-english -- https://master.php.net/note/delete/84268/non-english
Del: in docs -- https://master.php.net/note/delete/84268/in+docs
Del: other reasons-- https://master.php.net/note/delete/84268
Reject -- https://master.php.net/note/reject/84268
Search -- https://master.php.net/manage/user-notes.php