Re: Getting an advanced foreach to work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonas Rosling wrote:

...

while ($count < count($salespersons)) {

I see you have solved it - just one comment.

This particular line will get evaluated every time. If you have a large number of elements in $salespersons, it will slow things down considerably.

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.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux