Boolean


This is the simplest type which can be either TRUE or FALSE. Both TRUE and FALSE are case-insensitive.

To explicitly convert a value to Boolean, use the (bool) or (boolean) casts and this is also case-insensitive.

<?php
  $bool_true = TRUE;             // Boolean true
  $int_test = 3;                 // integer 3
  $bool_test = (bool)$int_test;  // convert integer to Boolean
?>

When converting to Boolean, the following values are considered as FALSE.

The others are considered as TRUE. (Including string "0")