Alternative to filter_var( $var, FILTER_VALIDATE_BOOLEAN ).

Signature

wp_validate_boolean( $var )
var
 (mixed) Boolean value to validate.

Return

(boolean) Whether the value is validated.

Source

function wp_validate_boolean( $var ) {
	if ( is_bool( $var ) ) {
		return $var;
	}

	if ( 'false' === $var ) {
		return false;
	}

	return (bool) $var;
}
WP Trac GitHub

Link here