Re: multiple case-expressions for one case in switch ?
| From: | Pascal Jolin | Date: | Mon, 16 Oct 2000 16:00:37 +0000 |
| Subject: | Re: multiple case-expressions for one case in switch ? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-20384@lists.php.net to get a copy of this message | ||
The switch statement passes control to the first matching case, and only
stops on a break.
So, to get what you want, use:
switch ($variable) {
case "possibility1":
case "possibility2":
case "possibility5":
doThis($variable);
break;
case "possibility3":
doTheOther($variable);
break;
}
----- Original Message -----
From: "Rebecca" <rebecca@digitalpulp.com>
To: <php-general@lists.php.net>
Sent: Monday, October 16, 2000 11:51 AM
Subject: [PHP] multiple case-expressions for one case in switch ?
> should this work?
>
> switch $variable
> {
> case "possiblity1", "possiblity2", "possiblity5":
> doThis($variable);
> break;
> case "possiblity3":
> doTheOther($variable);
> break;
> case "possiblity4":
> break;
> }
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>