R4R Team working to provide free of cost for experienced and freshers

Tutorials | Examples|Interview Questions and Answers|Java Tutorials| C Tutorials | C++ Tutorials | Spring Tutorials| Hibernate Tutorials | JSP Tutorials | Servelets Tutorials| C# Tutorials | PHP Tutorials etc , Basics | Download Software | Data Types | Variables | Constant | Storage & Classes | Operators | Decisions Making | Loops | Functions| Numbers | Arrays | Pointers | String | Datastructure | Expressions | Preprocessor Statement | I/O | Exception Handling | OOPs Tutorial | Classes and object |C++ Inheritance Overloading | Polymorphism | Abstraction | Encapsulation | Interfaces | Multithreading etc

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