in reply to Use of SWITCH vs IF ELSE in speed and readability

Unless it's in a critical section of code, use whichever one seems most readable in your context. It's a tough call in this example, but sometimes I find the regex approach (what you were trying to do on the 3rd one) the most readable. When speed really counts, just use the elsifs. They're not so bad.
  • Comment on Re: Use of SWITCH vs IF ELSE in speed and readability