Open In App

Uppercase Booleans vs. Lowercase in PHP

Last Updated : 11 Feb, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

The boolean expresses the truth value. The Boolean represents two possible values: TRUE or FALSE. True can be given a value of 1, and False is given a value of zero.

To specify a boolean literal, use the constants TRUE or FALSE. Both are case-insensitive. It means that TRUE is equal to true and FALSE is equal to false. So it can be written as

true === TRUE and false === FALSE

Example 1: This example display the value of uppercase and lowercase boolean.




<?php
// PHP program to illustrates
// boolean value
  
// Declare a variable and initialize it
$boolean = TRUE;
  
// Display the value of variable
echo $boolean . "\n";
  
// Declare a variable and initialize it
$boolean = true;
  
// Display the value of variable
echo $boolean;
  
?>


Output:

1
1

Example: This example compare the uppercase and lowercase boolean value.




<?php
// PHP program to illustrates
// boolean value
  
// Declare a variable and initialize it
$var1 = TRUE;
$var2 = true;
  
// Check both boolean value is same or not
if($var1 == $var2)
    echo "TRUE and true both are same \n";
else
    echo "TRUE and true both are different \n";
  
// Declare a variable and initialize it
$var1 = FALSE;
$var2 = false;
  
// Check both boolean value is same or not
if($var1 == $var2)
    echo "FALSE and false both are same \n";
else
    echo "FALSE and false both are different \n";
?>


Output:

TRUE and true both are same 
FALSE and false both are same


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads