Re: switch statemnts.
| From: | Jason Brooke | Date: | Thu, 13 Jul 2000 00:18:09 +0000 |
| Subject: | Re: switch statemnts. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6342@lists.php.net to get a copy of this message | ||
Just don't forget the break; after each 'stuff'
jason
> This doesn't help with your query, but out of interest, in BBC BASIC on
> Acorn Risc OS machines there is a nice trick which can be done with the
> switch statement because of the way it is implemented. The PHP equivalent
> is:
>
> switch(TRUE)
> {
> case($v<=0):stuff;
> case($v==0):stuff;
> default:stuff;
> }
>
> It makes for much neater looking code than a load of elsifs.
>
> Cheers