Open
Description
Description
Hello everyone 👋
Did you know that...
It's possible to use a semicolon instead of a colon after a case like:
<?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.