Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13222 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89275 invoked by uid 1010); 8 Oct 2004 04:59:19 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 89141 invoked from network); 8 Oct 2004 04:59:19 -0000 Received: from unknown (HELO mail.zend.com) (80.74.107.235) by pb1.pair.com with SMTP; 8 Oct 2004 04:59:19 -0000 Received: (qmail 24916 invoked from network); 8 Oct 2004 04:59:17 -0000 Received: from localhost (HELO AndiNotebook.zend.com) (127.0.0.1) by localhost with SMTP; 8 Oct 2004 04:59:17 -0000 Message-ID: <5.1.0.14.2.20041007215816.0308c530@localhost> X-Sender: andi@localhost X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Thu, 07 Oct 2004 21:59:12 -0700 To: "Frank M. Kromann" , In-Reply-To: <10972058564320000@9866357972520000.9866341568840000> 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) References: <10972058564320000@9866357972520000.9866341568840000> It's always been like that and has been documented for ages in the manual. Andi At 08:24 PM 10/7/2004 -0700, Frank M. Kromann wrote: >Hello Everyone, > >I just discovered a small thing in the switch() statement. The position of >the default: clause has to be at the end of the code: > >$a = 1; >switch ($a) { > default : > case 0 : > $b = 1; > break; > case 1 : > $b = 2; > break; >} >echo $b; // should print 2 but it prints 1 > >$a = 1; >switch ($a) { > case 1 : > $b = 2; > break; > default : > case 0 : > $b = 1; > break; >} >echo $b; // prints 2 as expected. > >This is tested on Linux with PHP5 CVS-HEAD > >What changed ? > >- Frank > > > > > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php