Thread: PHP help please
View Single Post
  #1 (permalink)  
Old 03-09-2007, 06:28 PM
PR Design's Avatar
PR Design PR Design is online now
CSS Wizardry -- Not Gay!
 
Join Date: May 2007
Location: Yorkshire, England
Gender: Male
Posts: 4,878
Default PHP help please

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?
Reply With Quote