There are three boolean operators mentioned there: &&
(logical AND), ||
(logical OR), and XOR
(well, it's logical XOR, or 'exclusive OR'). All of these are binary ones - they take two operands. Its result, apparently, is a boolean value - either true
or false
.
Now, they function as follows:
&&
will only result intrue
if both its operands evaluate totrue
, otherwise the result will befalse
||
will only result infalse
if both its operands evaluate tofalse
, otherwise the result will betrue
XOR
will result infalse
if its operands evaluate to the same value - be ittrue
orfalse
, doesn't matter. But if one operand evaluates tofalse
, and another totrue
, the result istrue
.
Now, on the second part of your question: this...
echo true + true + false;
... doesn't have anything to do with boolean algebra. All the operands of +
are cast to the numeric type first, by the rules described in Type Juggling section of the PHP documentation. In short, true
is converted to 1
, false
to 0
; the result - 1 + 1 + 0
, or 2
, is printed out.