How to use comparison operators in switch statement in PHP
<?php
$number = 27;
switch(true)
{
case ($number > 100):
echo 'Bigger than hundred';
break;
case ($number < 100):
echo 'Lower than hundred';
break;
default:
echo 'Equal to hundred';
break;
}
?>
$number = 27;
switch(true)
{
case ($number > 100):
echo 'Bigger than hundred';
break;
case ($number < 100):
echo 'Lower than hundred';
break;
default:
echo 'Equal to hundred';
break;
}
?>
Comments
Post a Comment