Re: Deprecate alternate switch case syntax?
| From: | Theodore Brown | Date: | Wed, 20 Nov 2024 18:26:13 +0000 |
| Subject: | Re: Deprecate alternate switch case syntax? | ||
| References: | 1 2 | Groups: | php.internals php.internals |
| Request: | Send a blank email to internals+get-126005@lists.php.net to get a copy of this message | ||
On Wed, Nov 20, 2024 at 09:23 Kamil Tekiela wrote:
> Do you know why the two exist? Was there any historical reason for this?
>
> From what cmb69 said[1], it seems like it may exist because of the
> implicit semicolon in ?>, and after I tested it, it seems to be true.
> Was there ever any other reason?
Hi Kamil,
I hope no one writes code like that where separate <?php ?> tags are interleaved around each
switch, case, break, and endswitch statement. That's atrocious...
Per the previous discussion that Claude linked to, the alternate syntax is a leftover from PHP/FI 2,
where nearly all lines including if conditions and case statements were terminated by a semicolon.
[2]
[1]: https://github.com/php/php-src/issues/15258#issuecomment-2271809889
[2]: https://externals.io/message/109350#109363