PHP Switch

The switch statement is similar to a series of IF statements on the same expression, variable compares with value with multiple cases. Once the case match is found, a block of code is executed. one label have different name then to go for switch case, that is best choice.

SWITCH Statement

switch ($a) {
    case 0:
        echo "a equals to 0";
    case 1:
        echo "a equals to 1";

Result: a equals to 0