[nycphp-talk] range in switch/case
Adam Maccabee Trachtenberg
adam at trachtenberg.com
Thu Feb 5 13:46:25 EST 2004
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!
More information about the talk
mailing list