Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13240 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22602 invoked by uid 1010); 8 Oct 2004 18:31:54 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 21351 invoked from network); 8 Oct 2004 18:31:37 -0000 Received: from unknown (HELO mail.zend.com) (80.74.107.235) by pb1.pair.com with SMTP; 8 Oct 2004 18:31:37 -0000 Received: (qmail 6661 invoked from network); 8 Oct 2004 18:31:35 -0000 Received: from localhost (HELO AndiNotebook.zend.com) (127.0.0.1) by localhost with SMTP; 8 Oct 2004 18:31:35 -0000 Message-ID: <5.1.0.14.2.20041008113008.030931e0@localhost> X-Sender: andi@localhost X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Fri, 08 Oct 2004 11:31:32 -0700 To: Wez Furlong , Christian Schneider Cc: Sascha Schumann , "Frank M. Kromann" ,internals@lists.php.net In-Reply-To: <4e89b42604100809376fa31bfe@mail.gmail.com> References: <4166BC1E.3000308@cschneid.com> <5.1.0.14.2.20041007215816.0308c530@localhost> <5.1.0.14.2.20041008085139.048947a0@localhost> <4166BC1E.3000308@cschneid.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] switch() and default: From: andi@zend.com (Andi Gutmans) I don't think we should do anything about it. From day 1 we treated switch() like a loop as far as break/continue is concerned, mainly because we wanted break/continue to be consistent. You might find this odd but you actually have more power in PHP than in C as you can break out or continue from multiple loops. In my opinion this is definitely not something which should be changed at this point. BTW, I think we have a fix for the switch() thingy. I still have to look at it more closely before commiting though. Andi At 05:37 PM 10/8/2004 +0100, Wez Furlong wrote: >Slightly OT, but while we are on the subject of switch not being >C-ish, how about making it so that continue inside a switch block >behaves the way it does in C? > >This C code snippet: > >while (1) { > printf("top\n"); > switch (1) { > case 1: > continue; > } > printf("bork\n"); >} > >will print out "top\n" repeatedly. >The same code in PHP will print out "top\nbork\n" repeatedly. >The get the same behaviour as the C code you need to use continue 2 instead. > >IMO, this is awful, and at first I thought it was a BC break, but it >seems that the stock RHEL 4.3.2 version of PHP behaves the same way. > >What, if anything, should we do about this? > >--Wez.