我试图养成使用switch/case而不是if的习惯.我有以下几点:
switch($res['perm']){
case '0': $perm = "Invalid";
case '1': $perm = "Operator";
case '2': $perm = "Team Lead";
case '3': $perm = "Admin";
default: $perm = "Unknown - ".$res['perm'];
}
Run Code Online (Sandbox Code Playgroud)
哪里$res['perm'] = (int) 3..我试过没有单引号,但它仍然默认为"未知"..我做错了什么?