PHP MYSQL - Operators - 5.5 Logical Operators

 PHP MYSQL - Operators - 5.5 Logical Operators

PHP Logical Operators

The PHP logical operators are used to combine conditional statements.

OperatorNameExampleResult
andAnd$x and $yTrue if both $x and $y are true
orOr$x or $yTrue if either $x or $y is true
xorXor$x xor $yTrue if either $x or $y is true, but not both
&&And$x && $yTrue if both $x and $y are true
||Or$x || $yTrue if either $x or $y is true
!Not!$xTrue if $x is not true
Example 'and'

<!DOCTYPE html>
<html>
<body>

<?php
$x = 10;  
$y = 20;

if ($x == 100 and $y == 50) {
    echo "Vesrn Technologies!";
}
?>  

</body>
</html>
Output:
Vesrn Technologies

Logical operators are widely used when it necessary, dear student you can try remaining operators with your own.





Popular posts from this blog

Install Windows 7 Operating System - Practical

COPA Bits for Computer Based Test (CBT) by Venugopal Vanjarapu

COPA