Well, you don't have to take away all the "break;". :) For example, only here:
> switch ($foo) { > case 'step2': > do_step2(); > if ($error) $foo='step1'; //repeat step1 > break; - E > > >If you don't break, it continues to execute all the code until >the end of the switch, ignoring any subsequent case >statements. > >In my example, eliminating the break after step2 would >cause execution of do_step1(), but also do_something_else(), >which is not desired. > >--- "@ Edwin" <[EMAIL PROTECTED]> wrote: > > Actually, you can--just don't "break;". > > > > Try it. > > > > - E > > > > > > > >I'd like to be able to modify the switch variable inside a case > > >statement, like this: > > > > > >switch ($foo) { > > > case 'step2': > > > do_step2(); > > > if ($error) $foo='step1'; //repeat step1 > > > break; > > > > > > case 'step1': > > > do_step1(); > > > break; > > > > > > case 'a_third_thing': > > > do_something_else(); > > > break; > > >} > > > > > >Can you modify the variable ($foo) inside a case statement and > > >have it evaluated for subsequent 'case's like this? If not, I > > >will have to revert to a series of if statements, in which this can > > >be done: > > > > > >if ($foo=='step2') { > > > do_step2(); > > > if ($error) $foo='step1'; > > >} > > >if ($foo=='step1') { > > > do_step1(); > > >} > > >etc. > > > > > >Switch-case seems cleaner, and I'd prefer to stick with it. > > > > > >__________________________________________________ > > >Do You Yahoo!? > > >Yahoo! Finance - Get real-time stock quotes > > >http://finance.yahoo.com > > > > > >-- > > >PHP General Mailing List (http://www.php.net/) > > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > _________________________________________________________________ > > $B!"%)!"!&!"!"%C!"%K%U{v(B$B%O!&!"!&r'%1!&%M%R(B$B%3%o(B MSN >$B!&%e!&f'r'%C!&%=!#%7(B http://character.msn.co.jp/ > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >__________________________________________________ >Do You Yahoo!? >Yahoo! Finance - Get real-time stock quotes >http://finance.yahoo.com > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php _________________________________________________________________ $B2q0wEPO?$OL5NA!&=<http://auction.msn.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php