RE: [PHP] multiple case-expressions for one case in switch ?
| From: | Boget, Chris | Date: | Mon, 16 Oct 2000 16:00:32 +0000 |
| Subject: | RE: [PHP] multiple case-expressions for one case in switch ? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-20381@lists.php.net to get a copy of this message | ||
> should this work?
> switch $variable
> {
> case "possiblity1", "possiblity2", "possiblity5":
> doThis($variable);
> break;
> case "possiblity3":
> doTheOther($variable);
> break;
> case "possiblity4":
> break;
> }
No, what you want is this:
switch( $variable ) {
case "one":
case "two":
case "five":
doThis();
break;
case "three":
doThat();
break;
case "four":
doTheOthers();
break;
}
Chris