in reply to Converting to boolean

When I want clarity, or when I specifically want to avoid an undefined value, I tend to use the trinary operator:

$bool = $x ? 1 : 0;

When I want shortness I tend to use !!$x.

When I'm comparing truthness of two expressions, I factor out one of the !s:

if (!$x == !$y) { ... }

Hugo