SV: [PHP] Getting an advanced foreach to work
| From: | Jonas Rosling | Date: | Tue, 23 May 2006 09:46:49 +0000 |
| Subject: | SV: [PHP] Getting an advanced foreach to work | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-236700@lists.php.net to get a copy of this message | ||
-----Ursprungligt meddelande-----
Från: Chris [mailto:dmagick@gmail.com]
Skickat: den 23 maj 2006 10:24
Till: Jonas Rosling
Kopia: PHP List
Ämne: Re: [PHP] Getting an advanced foreach to work
> From a performance point of view you're much better off doing:
> $sales_count = count($salespersons);
> while($count < $sales_count) {
> ....
> The only reason to leave the count in the while statement is if you are
> adding/removing to that array within the loop, otherwise chuck it in a
> temp variable and use that instead.
Thansk alot for the tip.
// Jonas