Switch is faster than If?
#5

Switch and if got their own usage.
If you use if in switch place it will be slow and if you use switch in if place it will be slow.

How?
Lets say you need to check for 1 and 3000 by switch you do
PHP код:
switch(var)
{
    case 
1..3000:
    {
    }
    default:
    {
    }

At this case switch used in if place and will be slow so have to use
PHP код:
if(< var < 3001)
{


So we get to this point switch is faster when switch is needed ( your above post declears switch example )
And if is faster when if is needed.
Reply


Messages In This Thread
Switch is faster than If? - by rolex - 26.06.2017, 17:45
Re: Switch is faster than If? - by Toroi - 26.06.2017, 17:57
Re: Switch is faster than If? - by BiosMarcel - 26.06.2017, 17:58
Re: Switch is faster than If? - by rolex - 26.06.2017, 18:03
Re: Switch is faster than If? - by jlalt - 26.06.2017, 18:10
Re: Switch is faster than If? - by rolex - 26.06.2017, 18:13
Re: Switch is faster than If? - by jlalt - 26.06.2017, 18:30
Re: Switch is faster than If? - by rolex - 26.06.2017, 18:54
Re: Switch is faster than If? - by OneDay - 26.06.2017, 19:06
Re: Switch is faster than If? - by rolex - 26.06.2017, 19:21

Forum Jump:


Users browsing this thread: 1 Guest(s)