Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Date: Sat, 17 Aug 2013 09:51:39 +0200 From: Luuk User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 Newsgroups: comp.lang.php Subject: Re: switch with case 0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 32 NNTP-Posting-Host: 2001:980:9089:1:21d4:d36:de6f:5d47 X-Trace: 1376726102 news.xs4all.nl 15967 [2001:980:9089:1:21d4:d36:de6f:5d47]:42076 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.php:10545 On 17-08-2013 08:35, J.O. Aho wrote: > You can try this one: > > switch("123") { > case 0: > echo "it's 0\n"; > break; > > case 123: > echo "it's 123\n"; > break; > > default: > echo "it's NOT 0 nor 123\n"; > } or: You can try this one: switch("1e3") { case 0: echo "it's 0\n"; break; case 1000: echo "it's 1000\n"; break; default: echo "it's NOT 0 nor 1000\n"; }