Strict switch statements
| From: | Sara Golemon | Date: | Thu, 14 Jun 2018 04:53:20 +0000 |
| Subject: | Strict switch statements | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-102251@lists.php.net to get a copy of this message | ||
Just for casual discussion at this point:
https://github.com/php/php-src/pull/3297
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;
}
Love it? Hate it? See obvious flaws? The implementation is just a
rushed proof of concept, not something I've labored over, it may well
have bugs. Certainly wouldn't target anything earlier than 7.4, if at
all.
-Sara