Re: switch() and default:

From: Date: Fri, 08 Oct 2004 16:37:14 +0000
Subject: Re: switch() and default:
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-13238@lists.php.net to get a copy of this message
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.

« previous php.internals (#13238) next »