RE: [PHP] switch with multiple case
| From: | Matt Williams | Date: | Wed, 14 Mar 2001 12:36:28 +0000 |
| Subject: | RE: [PHP] switch with multiple case | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43818@lists.php.net to get a copy of this message | ||
switch($something)
{
case "this":
do this;
break;
case "those":
case "them":
do other;
break;
case "crap":
case "doesn't matter":
case "whatever":
do nothing;
break;
default:
print error;
}
> <snip>
> <%
> select case something
> case "this" do that
> case "those","them" do other
> case "crap","doesn't matter","whatever" do nothing
> case else print error
> end select
> %>
> </snip>
>
> IN PHP you can't do cases like that, because like in C, u must have a
> constant, not a list of them.
> Is there anyway to get pass this? Doing a case for each thing
> even tough it
> does the exact same thing as 10 others is going to get a little
> stupid code.
> ____________________________
> . Christian Dechery (lemming)
> . http://www.tanamesa.com.br
> . Gaita-L Owner / Web Developer
>
>
> --
> 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
>