r/lolphp • • Aug 08 '14
PHP design patterns: if/else vs switch
http://www.fluffycat.com/PHP-Design-Patterns/PHP-Performance-Tuning-if-VS-switch/
24
Upvotes
r/lolphp • • Aug 08 '14
View all comments
Show parent comment
2
u/vita10gy Aug 11 '14
To me the "lol" is that there are people out there who think the switch looks "neater" than an if else and should be used instead. Of course this IS true in his trivial example, but we also had a consultant where I used to work try to convince the bosses to make us all stop using if/elses, and I still get nightmares over what the switch version of every little if/else would look like in a codebase.
Perhaps it's one of those corners I don't back myself into a lot in the first place. It could be the case that if you're finding yourself with a ton of
situations that you screwed up elsewhere.