semicolon terminator for switch cases
| From: | Ilija Tovilo | Date: | Thu, 26 Mar 2020 18:37:07 +0000 |
| Subject: | semicolon terminator for switch cases | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-109350@lists.php.net to get a copy of this message | ||
Hi internals
Looking through the language grammer I discovered that switch cases can also be terminated with a
; instead of a :.
```
switch ($i) {
case 1;
return 1;
default;
return 2;
}
```
https://3v4l.org/o7nD8
This is in fact documented:
https://www.php.net/manual/en/control-structures.switch.php
What's the reasoning behind this? I find it weird an inconsistent.
Maybe something to deprecate in PHP 8.0.
https://wiki.php.net/rfc/deprecations_php_8_0
Regards