PHP Keywords: xor

20 February 2019 - 9:58am

Welcome to my series on every PHP keyword and its usage. Today's item: xor.

The xor (exclusive or) operator is a logical operator that will result in true if only one of its operands are true. If neither is true, or both of them are true, the result of the expression is false.

Example

<?php
// False
$a = false xor false;
$b = true xor true;

// True
$c = false xor true;
$d = true xor false;