Skip to content
Advertisement

Can a switch statement take two arguments?

is it posible for a PHP switch statement to take 2 arguements? For example:

JavaScript

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
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement