I thought I'd call upon the minds of the web's best for my little problem. Basically I'm really
really new to PHP and I'm using
this little book among other things. I'm on a tutorial about the
switch statement with this code:
Code:
switch ($name) {
case "Damon":
case "Shelley":
echo "Welcome, $name, you are my friend.";
break;
case "Adolf":
case "Saddam":
echo "You are no friend of mine, $name.";
break;
default:
echo "I don't know you, $name";
}
The problem is that if someone types damon or any other name in lowercase they get the default message. I could easily type both variations but when the list gets quite long it's going to be a nightmare!
Is there a snippet or script which will make the case irrelevant?