PHP – switch statement vs. function dispatching
When you start having too many cases in your switch statement, it might be worth looking into using a function lookup. This is possible in all languages where functions are first class citizens… <?php $post = "hello"; $info = "3.1415"; //———————————————————– // Version 1 – using a switch statement //———————————————————– switch ($post) { …
Continue reading ‘PHP – switch statement vs. function dispatching’ »