Re: Unifying logical operators
| From: | Christoph M. Becker | Date: | Tue, 10 Jul 2018 12:12:00 +0000 |
| Subject: | Re: Unifying logical operators | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-102705@lists.php.net to get a copy of this message | ||
On 10.07.2018 at 13:41, Rowan Collins wrote:
> 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.
Thanks. I stand corrected!
--
Christoph M. Becker