Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10165 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42283 invoked by uid 1010); 28 May 2004 21:01:36 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 42214 invoked from network); 28 May 2004 21:01:35 -0000 Received: from unknown (HELO smtp2.actcom.co.il) (192.114.47.35) by pb1.pair.com with SMTP; 28 May 2004 21:01:35 -0000 Received: from [192.168.80.34] (line106-24.adsl.actcom.co.il [192.117.106.24]) by smtp2.actcom.co.il (8.12.8/8.12.8) with ESMTP id i4SL1WJC024377; Sat, 29 May 2004 00:01:33 +0300 Message-ID: <40B7A984.6070702@actcom.net.il> Date: Sat, 29 May 2004 00:05:08 +0300 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040519 X-Accept-Language: en-gb, en-us, en, he, ru MIME-Version: 1.0 To: Ard Biesheuvel CC: internals@lists.php.net References: <40B76426.8080107@php.net> In-Reply-To: <40B76426.8080107@php.net> X-Enigmail-Version: 0.84.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] switch labels in sub-blocks From: ilya79@actcom.net.il (Ilya Sher) Ard Biesheuvel wrote: > Hi all, > > is there a specific reason why nested blocks in switch statements are > not supported ? It can be very useful if you want to jump into the > middle of the first iteration of a loop (like fetching rows from a > result set where the first row might or might not be already present) > > Eg. > > switch ($i) { > > case 0: > do { > // iteration > default: > } while ( /* some condition */ ); > } > It looks like using "goto" to me. Messy. That's probably the reason it is not allowed. Or maybe other people like myself failed to understand how it is really useful. Real example from you would help here. Anyway, are you really sure you want to do that? #### (what it would be with "goto") #### $i=7; $t=0; switch($i) { case 0: do { echo "($t)"; label1: echo "[$t]"; } while(++$t<3); default: goto label1; } #### Just my 2 agoras...