Re: PHP 4.0 Bug #8428 Updated: continue doesn't pass thru a switch statement

From: Date: Sun, 07 Jan 2001 05:57:44 +0000
Subject: Re: PHP 4.0 Bug #8428 Updated: continue doesn't pass thru a switch statement
References: 1 2 3  Groups: php.dev 
Request: Send a blank email to php-dev+get-43200@lists.php.net to get a copy of this message
Hi, I think that consistent behavior is to make continue in switch valid for nearest enclosing loop. just like the behavior of break/continue in if/else statements. I never knew about this behavior and just have fixed some rare cases in some of my scripts... I have _never_ thought that a continue can break a switch. also I suppose many other people (if they have not found the thing themselves) have written code with the idea that continue continues loop statements not switch ones. further more if the break/continue are accepted to be a block operators we must be able to write code like if ($stuff=get_stuff()) { echo $stuff; if ($stuff=="error in get_stuff") break; continue; } which is _ridiculous_... b. ----- Original Message ----- From: "Zak Greant" <zak@nucleus.com> To: "Cynic" <cynic@mail.cz> Cc: <php-dev@lists.php.net> Sent: Saturday, January 06, 2001 6:33 AM Subject: Re: [PHP-DEV] PHP 4.0 Bug #8428 Updated: continue doesn't pass thru a switch statement > Cynic wrote: > > Um, I don't know. This looks to me like trying to hide problems/ > > inconsistencies/bugs too easily. :) I think it should stay in > > the bug realm. > > I, just like the other guy, consider this a bug. What good > > is continue within switch if it's the same as break, while it's > > clearly (meant to be) something different? It could as well > > trigger an error: 'use break instead'. > > We should ask the core developers how they want continue + > switch to work. I would guess that it was an oversight when > they were writing the language parser, but you never know... > > If it comes to group concensus, my vote is to change switch > to handle continue like if. > > The reason that I classed it as a feature request is because > switch + continue has behaved in this way for a long time. > > The behavior the user wants can be achieved with a minor > modification to their code. However, if PHP gets changed > to accomodate the behavior that the user wants, then other > people may have to change their code. > > Just my 0.02 cents > > --zak

« previous php.dev (#43200) next »