CrOuZ wrote:So Switch case is faster and better
Be careful with statements like this you may regret them... 😃
Switch is a powerful tool with many and varied possibilties, much greater than many people realise - I highly recommend everyone read this thoroughly insightful comment on the PHP manual page - but it won't do everything.
Overall, a switch structure will probably take more CPU cycles to get the same job done, as it effectively does more comparisons due to the fact it is really a looping structure. Sometimes a well written elseif tree is just the ticket - it takes careful consideration to decide which is best for any given task.
Remember, pretty code is not necessarily efficient code...