Boolean data type

Booleans is one of the PHP data types. Booleans expresses keywords either are TRUE or FALSE. The boolean type was introduced in PHP 4. which type TRUE or FALSE keywords both are case-insensitive. True is usually take a value of 1, and False is take a value of zero.

Php Booleans syntax

<?php
 $test = True;
?>
The above syntax assign the value TRUE to $test.

Example


<?php
 echo $true = true;
 echo $false = false;
 echo True: $true;
 echo "<br/>;"
 echo False: $false;
?>

Out Put

True: 1
False:

$true variable lines do not need to be in quotations. which are not strings, they are logical operators. echo "True: $true"; will echo true booleans .which PHP output for true is the number 1 and echo "False: $false"; will echo false booleans this PHP output for nothing.