Case statements followed by a semicolon (;) are deprecated, use a colon (:)¶
Description¶
It is possible to use a semi-colon ; instead of a colon : after a case in a switch. This is deprecated in PHP 8.5, and will disappear in PHP 9.
Example¶
<?php
switch($a) {
case 1;
echo one;
break;
}
?>
Solutions¶
Replace the semicolon by a colon.
Do not place a closing tag after a case value.
Changed Behavior¶
This error may appear following an evolution in behavior, in previous versions. See case-with-semicolon.