PHP Syntax Datatypes Scalar Boolean

 

- Info:

- Boolean datatype represents truth, supporting only two values: TRUE and FALSE (case insensitive).

- Alternatively, you can use zero to represent FALSE, and any nonzero value to represent TRUE.

- Boolean datatype is named after mathematician George Boole (18151864).

 

- Example:

- Create PHP Console Application Test.php.

 

Test.php

<?php

$alive = false; // $alive is false.

$alive = 1; // $alive is true.

$alive = -1; // $alive is true.

$alive = 5; // $alive is true.

$alive = 0; // $alive is false.

?>