<?php $a = true; $b = false; if ($a xor $b) { echo 'Either $a or $b is true. But not both'; } $a = true; $b = true; if ($a xor $b) { echo 'This is not echoed because both $a and $b are true'; }