note 93450 deleted from control-structures.switch by danbrown

From: Date: Thu, 10 Sep 2009 15:08:55 +0000
Subject: note 93450 deleted from control-structures.switch by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160419@lists.php.net to get a copy of this message
Note Submitter: pbervoets ---- varnavruz I don't think you'll ever get 'That's slooooow' because >10 is also >1 and it will encounter a break. You should reverse your cases (and you can use a default): switch ($totaltime) { case ($totaltime > 10): echo "That's slooooow"; break; case ($totaltime > 1): echo "Not fast!"; break; default: echo "That was fast!"; break; } The only thing I noted was that 0 evaluates to bigger than 10 (or even > 9999999999)!

« previous php.notes (#160419) next »