Operators In PHP

PHP Booleans

True and False these tow or some special meaning and called Boolean values. True is usually given a value of 1 and False is given a value of zero. You can initialize the values as :
$true_value = 1;
$false_value = 0;
You can replace the 1 and 0 with the words "true" and "false" (without the quotes).


<?php

$true_value = true;

$false_value = false;

echo "true_value = " . $true_value;

echo " false_value = " . $false_value;

?>

 
 

The out put is very simple
True value=1
False value=
False value print nothing.
You can also compare the True value and False value in If statement in following way

 
 $value = true;

if ($value)

 {

echo "This is True";

}

This is a short cut method of writing if( $value==True).