Reply to Re: [PHP] delete part of array

Your name:

Reply:


Posted by John Nichel on 01/13/05 23:22

Ford, Mike wrote:
<snip>
> Without actually running it (I'm too lazy!), I'm pretty sure this won't work
> correctly -- the count($array) is being recalculated each time round the
> loop, so each time you do an unset() it will reduce by one, resulting in the
> last few elements never being checked.
</snip>

Not too much on this topic, but to save youself a few cpu cycles, you
could put your size outside of the for loop

$size = sizeof ( $array );
for ( $i = 0; $i < $size; $i++ )

Putting it inside the for() makes it call that function on every loop.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@kegworks.com

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация