switch statements
Posted: Sun May 20, 2007 2:05 pm
In every example of the switch() function I have seen, there is only one variable. Can switch do many variables.
For Example:
This example is minimal but I want to apply that technique in a different function.
If this cannot be done does anyone have any other suggestions?
My only thought would be:
For Example:
Code: Select all
switch($var1, $var2, $var3){
case: blue, furry, peach;
echo "you have a blue furry peach";
break;
default:
echo "you don't have a blue furry peach"
break;
}If this cannot be done does anyone have any other suggestions?
My only thought would be:
Code: Select all
<?php
$var1="blue";
$var2="furry";
$var3="peach";
if ($var1=="blue" && $var2=="furry" && $var3=="peach")
echo "You have a blue furry peach.";
else
echo "You don't have a blue furry peach";
?>