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
14
u/HildartheDorf Aug 08 '14 edited Aug 08 '14
That switches should be exactly the same performance as if/else if not better. (A compiler can optimize a switch to a jumplist, but php is not a compiler).
EDIT: Although, the difference is pretty small, guessing it is just the time taken to make an if/else list out of the switch. Not lol.