Refinansiering uten Sikkerhet | 4K Näyttö | Beste Kredittkort med Rabatt | Strømpris | Beste Brannalarm 2018 | Behandlingsforsikring | Billigste Mobilabonnement | Beste Boliglån
Php

PHP Boolean type data Tutorial

Written by Tusher

Boolean data type that is meant to sense the binary data. It can contain two values, such as true and false. 0 is indicated by the false, likewise without any positive or 0 Karnataka real true is indicated by the number. Generally disclose the results of any Boolean logical statement is used in the data type.

  • $ A = true; Published // $ a Boolean value of true
  • $ B = false; Published false Boolean value of $ b //
  • $ C = 1; // True Boolean value of $ c published
  • $ D = 5; // True Boolean value of $ d published
  • $ E = 0; Published false Boolean value of $ f //
  • $ F = -7; // $ E to reveal the true boolean value

Practice Project

<html>
<head>
<title> www.trickbd.com.bd</title>
<style>
body{background: #00cc99 ; color: #000000;}
h2{color: #663300;}
h1{color: #CC00CC;}
</style>

</head>
<body>
<?php
$a = true;
echo “A=”.$a;
echo “<br />”;
$b = false;
echo “B=”.$b;
echo “<br />”;
$c = 1;
echo “C=”.$c;
echo “<br />”;
$d =5;
echo “D=”.$d;
echo “<br />”;
$e= 0;
echo “E=”.$e;
echo “<br />”;
$f= -7;
echo “F=”.$f;
echo “<br />”;
if($a && $b)
{echo ” A and B = true “;}
echo “<br />”;
if($a && $c)
{echo ” A and C = true “;}
echo “<br />”;
if($a && $d)
{echo ” A and D = true “;}
echo “<br />”;
if($a && $e)
{echo ” A and E = true “;}
echo “<br />”;
if($a && $f)
{echo ” A and F = true “;}

?>

</body>

</html>

  • $ A = true; $ A is a boolean variable, expressed as the number has been set to true.
  • echo “A =”. $ a; A = 1 text will be displayed by the browser. (Because the browser looks as true a 1)
  • $ B = false; $ B is a Boolean variable, expressed as a false number has been set.
  • echo “B =”. $ b; B = the text to be displayed by the browser. (Who is false, because the browser shows a blank space)
  • $ C = 1; $ C variables expressed as an integer number 1 has been set.
  • $ D = 5; $ D variable, expressed as an integer number 5 has been set.
  • $ E = 0; $ E variables expressed as an integer number of 0 has been set.
  • $ F = -7; Expressed as an integer number -7 $ f variable has been set.

During operation, all data on the logical data usually serves as a Boolean. $ C, $ d, $ e, $ f, although the value of the integer number, but by the time the logical operation. $ C, $ d, $ e, $ f Boolean value true, true, false, true.
Logical operators, and flow control will be discussed in more detail, but let’s be aware that the logical and the two variables is true, then the results of operations both variables to be true.

  • if ($ a && $ b) {echo “A and B = true”;} public boolean value if $ a and $ b are true, both A and B = true, then

the text will be displayed.(text will not be displayed because $ a = true and $ b = false)

  • if ($ a && $ c) {echo “A and C = true”;} public boolean value if $ a and $ c is true of both the A and C = true, then the text will be displayed. (text will be displayed in the $ a the boolean = true and $ c = 1 $ c = true).
  • if ($ a && $ d) {echo “A and D = true”;} public boolean value if $ a and $ d is true of both the A and D = true, then the text will be displayed. (text will be displayed in the $ a Boolean = true and $ d = 5, the value of $ d = true).
  • if ($ a && $ e) {echo “A and E = true”;} public boolean value if $ a and $ e is true of both the A and E = true, then the text will be displayed. (text will not be displayed because $ $ e = 0 a = true and the boolean value of $ e = false).
  • if ($ a && $ f) {echo “A and F = true”;} public boolean value if $ a and $ f is true in both the A and F = true, then the text will be displayed. (text will be displayed in the $ a Boolean = true, and the value of $ d = -7 $ f = true).

About the author

Tusher

Leave a Reply