In the logical operator of PHP, XOR represents a logical XOR or
$a XOR $b
Results
Returns true if the $a and $b have and only one is true, or False if all are true or false.
However, when testing the XOR operator, a little problem was found
error Condition 1
<?php
$a = False xor true;
Var_dump ($a);
? >
result 1
Boolean false
Situation 2
<?php
$a = True xor false;
Var_dump ($a);
? >
Result 2
Boolean true
What the hell is going on here?
Let's change the way the XOR operator is tested
Situation 3
<?php
echo False xor true;
? >
result 3
1
So there's no problem, so what's wrong with the first two cases?
Situation 4
<?php
$a = (false xor true);
Var_dump ($a)
?>
Result 4
Boolean true
This is true, and visibility should be caused by operator precedence.
In PHP, theoperator precedence of and, or, XOR is lower than = , in which case it would be nice to add a parenthesis ...