php-如何将这个IF条件放在switch中?

Kav*_*veh 4 php switch-statement

请帮我纠正这段代码,我想把它放在内部切换:

switch ($urlcomecatid) {

 if ($urlcomeparentid == 1 || $urlcomeparentid == 2 || $urlcomeparentid == 3)
  break;

case "50":
case "51":
case "52":
case "109":
case "110":
    //do nothing and exit from switch
    break;
default:
    header ("Location:http://www.example.com/tech/tech.php"); exit();
    break;
Run Code Online (Sandbox Code Playgroud)

}

P. *_*iro 6

正确的代码应该是这样的

switch ($urlcomecatid) {
    case "50":
    case "51":
    case "52":
    case "109":
    case "110":
        //do nothing and exit from switch
        break;
    default:
        if ($urlcomeparentid == 1 || $urlcomeparentid == 2 || $urlcomeparentid == 3)
            break;
        header ("Location:http://www.example.com/tech/tech.php"); exit();
        break;
 }
Run Code Online (Sandbox Code Playgroud)