PHP Programing language

Logical Operator
Previous Home Next

<html>
<head>
<title>Using Logic Operator</title>
</head>

<body>
<h1>Logic Operator</h1>
<pre>
$q = 10;
$r = 5;
$s = 15;
$t = 15;
</pre>
<?php
$q = 10;
$r = 5;
$s = 15;
$t = 15;
$u = ($q > $r) and ($s > $t);
$v = ($q > $r) && ($s > $t);
$w = ($q > $r) or ($s > $t);
$x = ($q > $r) || ($s > $t);

$y = ($q > $r) xor ($s > $t);
$z = ($q < $r) xor ($s > $t);

$a = ($q > $r);
$b = !$a;
printf ("(q > r) and (s > t) = %d <br>",$u);
printf ("(q > r) && (s > t) = %d <br>",$v);
printf ("(q > r) or (s > t) = %d <br>",$w);
printf ("(q > r) || (s > t) = %d <br>",$x);
printf ("(q > r) xor(s > t) = %d <br>",$y);
printf ("(q < r) xor (s > t) = %d <br>",$z);
printf ("(q > r) and (s > t) = %d <br>",$u);
printf ("(q > r) = %d <br>",$a);
printf ("!a = %d <br>",$b);
?>
</body>
</html>

 

output
Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: