Thursday, September 4, 2025
HomeLanguagesUppercase Booleans vs. Lowercase in PHP

Uppercase Booleans vs. Lowercase in PHP

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
RELATED ARTICLES

Most Popular

Dominic
32260 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6625 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6746 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6694 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS