php tutorial - PHP Datatypes Boolean - php programming - learn php - php code - php script



  • Boolean is the simplest data type. It’s Like a switch that has only two states ON means true or 1 and OFF means false or 0.
  • Booleans is frequently used in conditional testing in most of the cases.

php code Syntax :

<?php
    $x = true;
    $y = false;
?>
click below button to copy the code. php tutorial - team

learn php Sample Code : a simple php program

<!DOCTYPE html>
<html>
    <head>
        <title>Datatype-Boolean</title>
    </head>
    <body>
        <?php
            $true=true;
	    $false=false;
            var_dump($true,$false);
        ?>
    </body>
</html>
click below button to copy the code. php tutorial - team

php examples Code Explanation :

Code Explanation for Datatype Boolean In PHP

  1. In PHP 7 and generic php language, $true variable is declared to hold value=true.
  2. In PHP 7 and generic php language, $false variable is declared to hold value=false.
  3. var_dump($true,$false) function returns the data type and value in terms of boolean. ($true,$false) variables will display boolean output as shown below.

php tutorials Sample Output :

output for Datatype Boolean In PHP

  1. var_dump() function returns the data type with its value in terms of Boolean as shown in the browser window.


Related Searches to php datatype boolean