Re: for loop inside a switch
| From: | Robert Cummings | Date: | Sat, 01 Sep 2007 01:26:41 +0000 |
| Subject: | Re: for loop inside a switch | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261579@lists.php.net to get a copy of this message | ||
On Fri, 2007-08-31 at 15:56 -0700, Dan wrote:
> Sanjeev is right. You're thinking about the problem backwards. You're
> trying to build a Switch inside a loop. Remember, if you ever have to do
> some operating multiple times you're using a forloop, then the thing that
> you want to repeat(switch case) is INSIDE the for loop.
Not always true. Sometimes once you've made the switch it applies to all
members of a data array. In which case switching on every iteration is a
waste of processor since you can check a single time outside the loop.
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................