我正在编写一堆条件,使用 if 语句,有没有办法简化它以使其看起来更好?
$value = "1";
if (($subvalue == 1) && ($subbucket == 1)){
$value = "1";
}
if (($subvalue == 1) && ($subbucket == 2){
$value = "1A";
}
if (($subvalue == 1) && ($subbucket == 3)){
$value = "2A";
}
if (($subvalue == 2) && ($subbucket == 1)){
$value = "3A";
}
if (($subvalue == 2) && ($subbucket == 2)){
$value = "3B";
}
if (($subvalue == 2) && ($subbucket == 3)){
$value = "3C";
}
我发现它很乱,有没有办法重写这个?