Hi!
> switch ($a) {
> case FOO:
> // Works exactly as current behavior.
> break;
> case == FOO:
> // Nearly identical, though not using the ZEND_CASE optimization.
> // Can probably make this equivalent to `case FOO`, but it felt
> like an interesting direction.
> break;
> case === FOO:
> // Only triggers if `$a === FOO`, no type juggling
> break;
> }
With current tendency to move to more strict interpretation and a bit
away from type juggling, I think it has its place. But I am not a big
fan to putting === there, it looks weird. Maybe go a bit further and
make the whole switch strict?
strict switch ($a) {
case FOO:
case BAR:
// both are strict ===
}
I imagine people that like strict style would want to use strict
everywhere, so for them using === every time might be annoying. This way
it makes for easier read for both strict and weak typers.
--
Stas Malyshev
[email protected]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php