On 31-12-2009 at 15:23:20 Iván Montes <drsl...@pollinimini.net> wrote:
I've put together a very simple chunk iterator  which works with
arrays, traversables and iterators. There is also an example tales
Perhaps it could even be added to the standard PHPTAL code base?
That's a good start, but doesn't avoid creation of arrays yet. What I
actually had in mind was pair of iterators (one for rows like you've
created, another for each row) that doesn't create PHP array at any point,
just passes calls to the innermost iterator. That would ensure constant
memory usage (rather than 1/number_of_columns) on arbitrarily large
iterations, which I think is the major reason to use iterators instead of
(presumably faster) array_chunk(iterator_to_array()).
PHPTAL mailing list