RE: [PHP] Function Switch($pid) - NEED HELP
| From: | David Freeman | Date: | Sat, 25 May 2002 23:33:39 +0000 |
| Subject: | RE: [PHP] Function Switch($pid) - NEED HELP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-99275@lists.php.net to get a copy of this message | ||
> I have a script that switches.
> switch($pid)
> {
> case 1:
> break;
>
> case 2:
> break;
> }
>
> Now I'm doing a check in case 1 and if everything goes well,
> i want to switch directly to case 2 while the script is runny.
>
> How would i do that ???
In the specific case above you could do something like this in your case
1 -
case 1:
if (some test)
{
test sucessful - on to case 2
} else {
break;
}
That will fall through from case 1 to case 2 depending on the success of
a check.
CYA, Dave