[php-src] Issue #15258: Deprecate semicolons after case in switch statement

From: Date: Tue, 06 Aug 2024 16:25:42 +0000
Subject: [php-src] Issue #15258: Deprecate semicolons after case in switch statement
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247447@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15258 Author: upyx ### Description Hello everyone :wave: Did you know that... > It's possible to use a semicolon instead of a colon after a case like: ```php <?php switch($beer) { case 'tuborg'; case 'carlsberg'; case 'heineken'; echo 'Good choice'; break; default; echo 'Please make a new selection...'; break; } ?> ``` This has been working since at least PHP 4: https://php-legacy-docs.zend.com/manual/php4/en/control-structures.switch I had never seen syntax like this until I accidentally wrote it myself. The resulting code confused everyone. IMO, this syntax doesn't have benefits and can lead to mistakes. Therefore, I propose to deprecate it and remove it from future versions.

« previous php.bugs (#247447) next »