logical operators in php : && , || , !
<?php
$a=10;
$b=20;
if($a<15 && $b>15)
echo "$a is less than 15 and $b is grater than 15";
?>
output : 10 is less than 15 and 20 is grater than 15
<?php
$a=10;
$b=20;
if($a<15 || $b<15)
echo "$a is less than 15 and $b is grater than 15";
?>
output : 10 is less than 15 or 20 is grater than 15
<?php
$a=10;
$b=20;
if(!($a<15 && $b>15))
echo "$a is less than 15 and $b is grater than 15";
?>
output :
nothing to display , because , inner value is true and we apply ! to that so , the value of if statement is false
<?php
$a=10;
$b=20;
if($a<15 && $b>15)
echo "$a is less than 15 and $b is grater than 15";
?>
output : 10 is less than 15 and 20 is grater than 15
<?php
$a=10;
$b=20;
if($a<15 || $b<15)
echo "$a is less than 15 and $b is grater than 15";
?>
output : 10 is less than 15 or 20 is grater than 15
<?php
$a=10;
$b=20;
if(!($a<15 && $b>15))
echo "$a is less than 15 and $b is grater than 15";
?>
output :
nothing to display , because , inner value is true and we apply ! to that so , the value of if statement is false