Wednesday, July 3, 2024
HomeLanguagesPhpUppercase 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

Nicole Veronica Rubhabha
Nicole Veronica Rubhabha
A highly competent and organized individual DotNet developer with a track record of architecting and developing web client-server applications. Recognized as a personable, dedicated performer who demonstrates innovation, communication, and teamwork to ensure quality and timely project completion. Expertise in C#, ASP.Net, MVC, LINQ, EF 6, Web Services, SQL Server, MySql, Web development,
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments