News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
Ibuildings Blog:
Implementing Iterators
August 20, 2008 @ 15:02:59

On the Ibuildings blog Ruud Alberts takes a look at iterators - what they are and how they're used (including the objects the SPL makes available).

Let's kickstart this blogpost by defining what an iterator actually is. According to wikipedia, an iterator is. A collection can pretty much be anything. The most obvious sources would be arrays, but other than that, iterations can be done over database resultsets, strings, datetime intervals, directories, file content and XML listings, to name a few.

He looks at the iterator interface that comes bundled in the SPL and how you can create a custom one to loop through your own data collection. He includes an example - a colorful string iterator that "pretties up" an HTML string with various colors.

0 comments voice your opinion now!
iterator standard library spl custom color string tutorial



Similar Posts

Devshed: A Close Look at the GD Library in PHP

Joshua Eichorn's Blog: How would you improve PEAR?

The Bakery: Nine New Tutorials, Helpers and Plugins for CakePHP

AlternateInterior.com: Communicating with threads in PHP

PHP Thinktank Blog: SPL and php.NET (phalanger) IRC logs


Community Events









Don't see your event here?
Let us know!


conference mysql ajax zend cakephp code PHP5 release package book example application releases developer PEAR job security database framework zendframework

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework