私のコードでは、入れ子になった if-else 条件がたくさんあります。34回くらいやってます。本当に頭がおかしくなりそうです。減らす方法を教えてください。ありがとうございました。
そしてここに私のコード:
if ($input_age > $age_min && $input_age <$age_max){
if ($input_heigh > $heigh_min && $input_heigh < $heigh_max){
if ($input_ds == "yes" && $ds_val=="yes" ){
//some calculation
}
else if ($input_ds == "no" && $ds_val=="yes"){
//some calculation
}
else if ($input_ds == "yes" && $ds_val=="no"){
//some calculation
}
else if ($input_ds == "no" && $ds_val=="no"){
//some calculation
}
}
else if ($input_heigh < $heigh_min || $input_heigh > $heigh_max){
if ($input_ds == "yes" && $ds_val=="yes" ){
//some calculation
}
else if ($input_ds == "no" && $ds_val=="yes" ){
//some calculation
}
else if ($input_ds == "yes" && $ds_val=="no"){
//some calculation
}
else if ($input_ds == "no" && $ds_val=="no" ){
//some calculation
}
}
その他の if-else 条件