RE: [PHP-DEV] Make switch/case to type sensitive comparison in PH P 5?
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | RE: [PHP-DEV] Make switch/case to type sensitive comparison in PH P 5? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-314@lists.php.net to get a copy of this message | ||
> > I'd really not love to see it :) Use an if-else chain of ===
> > comparisons
> > instead if that's what you really need.
>
> Oh, well, fair enough -- I can live with that, although I think it's a less
> elegant way of programming it. Still, nothing ventured nothing gained...!
> ;)
Mike, changing this would break all sorts of stuff, and I think it would
confuse a lot of people. If HTML form variables were somehow typed by the
browsers, then it might make sense, but people are going to write code
like:
switch($input) {
case 1:
...
case 2:
...
case 3:
...
}
Forcing people to worry about the type on user input goes against the
basic nature of PHP.
-Rasmus