Re: Unifying logical operators
| From: | Rowan Collins | Date: | Tue, 10 Jul 2018 11:41:15 +0000 |
| Subject: | Re: Unifying logical operators | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-102703@lists.php.net to get a copy of this message | ||
On 10 July 2018 at 12:09, Christoph M. Becker <cmbecker69@gmx.de> wrote:
>
> “xor” is equivalent to ^ (sans the precedence).
>
No, that's a *bitwise* XOR, which is a completely different operation:
var_dump(1 xor 2); // bool(false)
var_dump(1 ^ 2); // int(3)
A consistent logical XOR with the same precedence as || and && could
perhaps be spelled ^^, but there is no such operator in PHP.
Regards,
--
Rowan Collins
[IMSoP]