NYCPHP Meetup

NYPHP.org

[nycphp-talk] range in switch/case

Chris Bielanski Cbielanski at inta.org
Thu Feb 5 13:52:57 EST 2004


Cool, just wanted a definitive 'no' :) As it is, I don't really care if the
user manages to jam some odd value in there since it's building a SELECT
statement and nothing "dangerous".

Hooray for 'default' case!! :P

Thanks!
Chris Bielanski - [CBielanski at inta.org]
Web Programmer, 
International Trademark Association - [www.inta.org]
1133 Ave. of the Americas - Manhattan
p - 212/642-1745





-----Original Message-----
From: Adam Maccabee Trachtenberg [mailto:adam at trachtenberg.com]
Sent: Thursday, February 05, 2004 1:46 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] range in switch/case


On Thu, 5 Feb 2004, Chris Bielanski wrote:

> I'm being lazy - in Pascal/Delphi you can assign a range as a case in a
> switch statement. for example... case(0..255) or case('A'..'Z').
>
> Does PHP have a facility to do this? I note that the above doesn't like me
> very much ;)

No. Switch to an if()...elseif()...else() and use a regular expression
character class or something similar inside the if().

There was a brief talk of adding this to PHP, but it was rejected.

-adam

-- 
adam at trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk



More information about the talk mailing list