CKTIS / PHP
Keyword endswitch
Close the alternative syntax of switch.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
switch ($value): /* cases */ endswitch;Close the alternative syntax of switch. Case labels and fallthrough behave as in a braced switch; endswitch is the boundary of the selection and does not insert breaks between labels. Terminate a selected arm explicitly when the next label must not run.
$value="a";
switch($value): case "a": echo "A"; case "b": echo "B"; break; default: echo "X"; endswitch;
AB
Examples
<?php
$value="a";
switch($value): case "a": echo "A"; case "b": echo "B"; break; default: echo "X"; endswitch;
Result
AB