On 31-12-2009 at 04:44:34 romtek <rom...@gmail.com> wrote:

Thank you very much  for this sample! It's much more elegant, easier to
understand and maintain than what I've come up with. Things like this had
better be published in a special section of documentation. And I hope that array_chunk() doesn't copy data needlessly. This method does introduce more
overhead.

Kornel, what would you do if data were a collection but not an array
(besides using something like what was suggested by Rasmus Schultz at
http://php.net/manual/en/function.array-chunk.php)?

If it's small enough to fit in memory, then probably conversion to array with iterator_to_array() will be fastest.

Otherwise you could write something like IteratorIterator http://www.php.net/IteratorIterator that ignores reset() and pretends it ends every n elements.

--
regards, Kornel

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to