两种状态相同但值不同的SWITCH语句

时间:2019-06-03 08:43:20

标签: switch-statement

我在使用switch语句创建菜单系统时遇到问题。我有3级菜单,但不知道如何转到3级switch语句。例如,当前我在2级交换机中,但如何进入主(外部)交换机。

switch($userResponse)
case “1”:
   $response .= " 1. Model.\n”;
   $response .= " 2. Year1 \n”;
   $response .= " 3. company\n”;
   $response .= " 4. capacity\n”;   
    break;
case “2”:
   $response .= " 1. Model.\n”;
   $response .= " 2. color \n”;
   $response .= " 3. Speed\n”;
   $response .= " 4. Fuel type\n”;
    break;
case “3”:
    $response .= " 1. Model.\n”;
    $response .= " 2. passengers \n”;
    $response .= " 3. Captain  \n”;

    break;

0 个答案:

没有答案