:::

6. Switch statements

switch statement is similar to an ifelif / else statement in that you can check multiple conditions. Here's what it looks like:

$myNum = 2;

switch ($myNum) {
    case 1:
        echo "1";
        break;
    case 2:
        echo "2";
        break;
    case 3:
        echo "3";
        break;
    default:
        echo "None of the above";
}

:::

語系選擇