开关语句与 if 语句
2022-08-30 20:27:56
我陷入了两难境地。哪个最好使用以及为什么..开关还是如果?
switch ($x)
{
case 1:
//mysql query
//echo something
break;
case 2:
//mysql query
//echo something
break;
}
...
if ($x == 1) {
//mysql query
//echo something
}
if ($x == 2) {
//mysql query
//echo something
}