我并不热衷于 PHP,因此没有花太多时间学习语法,我只是想知道这个&&
运算符在开关大小写中语法是否正确,这样我就可以让多个大小写匹配一个大小写代码块。
case "msg" && "username":
/* enter the functions here */
break;
不,这不会正确运行。但是,您可以这样做:
case "msg":
case "username":
/* enter the functions here */
break;
更新了佩卡和马克的评论。
我并不热衷于 PHP,因此没有花太多时间学习语法,我只是想知道这个&&
运算符在开关大小写中语法是否正确,这样我就可以让多个大小写匹配一个大小写代码块。
case "msg" && "username":
/* enter the functions here */
break;
不,这不会正确运行。但是,您可以这样做:
case "msg":
case "username":
/* enter the functions here */
break;
更新了佩卡和马克的评论。