The example below is an extráct from http://php.net/manual/de/control-structures.switch.php
<?php
$totaltime = 0;
switch ($totaltime) {
case ($totaltime < 1):
echo "That was fast!";
break;
case ($totaltime > 1):
echo "Not fast!";
break;
case ($totaltime > 10):
echo "That's slooooow";
break;
}
?>
I expected the result as "That was fast." But actual result is "Not fast!". It would be great if some one can explain me why?
But if i add another case, case 0: echo "That was super fast!". Then it is echoing properly. i.e "That was super fast!". Please help me how to use conditional switch statement.
EDIT:-
Thanks all for your responses. I am able to overcome the above problem by modifyong switch($totaltime) to switch(1)