Re: Re: switch case - to require the break statements seems strange to me

From: Date: Mon, 01 Sep 2008 01:50:52 +0000
Subject: Re: Re: switch case - to require the break statements seems strange to me
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-279187@lists.php.net to get a copy of this message
Hi, Well, I see a good reason anyway... U can have a lot of entry points and only one to exit... Like: switch ($i) { case 0: echo "\$i < 1"; case 1: echo "\$i < 2"; case 2: echo "\$i < 3"; default: echo "\$i > 2"; } Or switch ($i) { case 0: case 1: case 2: echo "\$i < 3"; break; default: echo "\$i > 2"; } Nothing says that you can only use it as an option one statement... On Mon, Sep 1, 2008 at 2:04 AM, Lupus Michaelis <mickael+php@lupusmic.org<mickael%2Bphp@lupusmic.org> > wrote: > Govinda a écrit : > >> Or is there a better reason? >> > > What is exactly in $i ? A scalar integer, a string containing an integer ? > A boolean ? What version of PHP ? > > -- > Mickaël Wolff aka Lupus Michaelis > http://lupusmic.org > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Thanks for your attention, Diogo Neves Web Developer @ SAPO.pt by PrimeIT.pt

« previous php.general (#279187) next »