Switch CASE

Posted under » PHP on 14 Sep 2018

Normally we use the if statements but sometimes we use the case statements.

switch ($hai):
    case 1:
        $hoi = "Prof";
        break;
    case 2:
         $hoi = "A/Prof";
        break;
    case 3:
         $hoi = "Dr";
        break;
    case 4:
        $hoi = "Mr";
        break;
    case 5:
         $hoi = "Ms";
        break;
    case 6:
         $hoi = "Miss";
        break;
    case 7:
         $hoi = "Mrs";
        break;
    default:
         $hoi = "Not sure";
endswitch;

web security linux ubuntu GIT svn Raspberry apache mysql php drupal cake symfony javascript Ajax css