Logical_Operators
<?php
$age = 20;
$age1 = 25;
if($age >= 18 && $age <= 21)
{
echo "You are Eligible<br>";
}
if($age >= 18 || $age <= 21)
{
echo "You are Eligible<br>";
}
//Below condition is True So that "Not Operator(!)" will return False condition
if(!($age >= 18))
{
echo "You are Eligible<br>";
}
//Below condition is False So that "Not Operator(!)" will return True condition
if(!($age <= 18))
{
echo "You are Eligible<br>";
}
//If both condition is "True" OR "False" at that time xor will return "False" and if one condition is
//"True" and second condition "False" at that time xor will retun "True"
if($age >= 18 xor $age <= 21)
{
echo "You are Eligible brother";
}
if($age1 <= 18 xor $age1 >= 21)
{
echo "You are Eligible";
}
//OUTPUT:
//You are Eligible
// You are Eligible
// You are Eligible
// You are Eligible
?>
Comments
Post a Comment