Here are two useful tips to cast booleans very easily.

$boolean = !!$anything; // cast anything to a boolean
$integer = +$boolean; // cast a boolean to 0 or 1