Sunday, June 14, 2026
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
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS