RE: [PHP] Function Switch($pid) - NEED HELP
-Original Message- From: Vincent Kruger [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 25, 2002 8:41 AM To: [EMAIL PROTECTED] Subject: [PHP] Function Switch($pid) - NEED HELP 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 ??? I'm not sure I'm understanding your question properly. But does this do what you want? switch ($pid) { case 1: if (!test you want) then break; // If test is true, execution falls // through to next case case 2: ... break; } -- JR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function Switch($pid) - NEED HELP
Just don't do the break in case 1 if you want to fall through to case 2. On Sat, 25 May 2002, Vincent Kruger wrote: 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 ??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Function Switch($pid) - NEED HELP
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php