Boolean contains TRUE or FALSE value, which is specificly used in if statements that is one of the baces in control structure.
Boolean provides constants that are TRUE and FALSE

Interpreting other Types as Booleans

there are also some cases that are interpreted as TRUE or False values when they act like a Boolean type such as using them in if statements.

  • if the value is a number it is true if it is a number exept zero
  • if the value is a string it is true exept if it has zero of charachters or it is a charachter containing just this”0″
  • values of type NULL are always false
  • if the value is compund type such as array or an object of a class it is TRUE if it has a value and it is false if it has no other values .for an object of a class containing a value means having a member variable that has been assigned a value

Examples
True

$TrueNumber = 5 + 0.345;
$TrueString = "this contains strings of charachters";
$TrueArray[5] = 77;

False

$FalseNumber = 0;
$FalseString = "";
$FalseArray = array()
$FalseNull = NULL

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.