Re: Switch function problem
| From: | Bix | Date: | Wed, 11 Jun 2003 11:52:49 +0000 |
| Subject: | Re: Switch function problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151050@lists.php.net to get a copy of this message | ||
Cant be done mate, do it like this...
switch ($val){
case "FFS":
case "FHG":
case "FRG":
//stuff
break;
case "DPT":
case "DL":
case "DF":
case "DI":
case "DO":
//stuff
break;
}
The cases pass through each other till they hit a 'break'
;o)
Bix
"Stephen Goddard" <stephen@netsmartsales.com> wrote in message
news:20030611114741.61540.qmail@pb1.pair.com...
> Hi Folks,
>
> Anyone know if you can use operators in a switch function? eg.
>
>
> switch ($category){
> case "FFS" || "FHG" || "FRG":
> $soldID = "SFFS";
> break;
> case "DPT" || "DL" || "DF" || "DI" ||
> "DO":
> $soldID = "SDPT";
> break;
> }
>
> Cheers
>
>