is it posible for a PHP switch statement to take 2 arguements? For example:
JavaScript
x
switch (firstVal, secondVal){
case firstVal == "YN" && secondVal == "NN":
thisDesc = "this is the outcome: YN and NN";
break;
case firstVal == "YY" && secondVal == "NN":
thisDesc = "this is the outcome: YY and NN";
break;
}
Many thanks, I haven’t done PHP in years!
Advertisement
Answer
No, but if your case is as simple as what you have, just concatenate the two inputs and test for the concatenated values:
JavaScript
switch ($firstval . $secondval) {
case "YNNN":
case "YYNN":
}