[PHPTAL] while loop in PHPTAL
drslump at pollinimini.net
Thu Dec 31 16:23:20 CET 2009
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?
On 12/31/09 11:02 AM, Kornel Lesiński wrote:
> On 31-12-2009 at 04:44:34 romtek <romtek at 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
>> better be published in a special section of documentation. And I hope
>> array_chunk() doesn't copy data needlessly. This method does
>> introduce more
>> 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
> 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.
More information about the PHPTAL