News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Thomas Weinart:
What Iterators Can Do For You
August 01, 2012 @ 09:55:22

Thomas Weinert has a new post to his site showing some of the things that iterators can do for you (including working with arrays and aggregation).

Basically Iterators provide a list interface for an object. Like all interfaces they are a contract how something can be used. If you use an interface it is not relevant how it is implemented - the implementation logic is encapsulated. It is of course relevant on the integration level. A bad implementation can impact the performance of you application. Even an good implementation may need special resources (like a database). But all this does not impact how you use it. Your code using the object with the Iterator interface stays the same.

He shows how to use the IteratorAggregate, ArrayIterator, FilterIterator and how to create a custom Iterator that you can extend in your own code.

0 comments voice your opinion now!
iterator tutorial array filter aggregate custom


blog comments powered by Disqus

Similar Posts

Sameer Borate: PHP applications on Google App Engine

Jakub Zalas' Blog: Managing object creation in PHP with the Symfony2 Dependency Injection component

Linode Library: Deploy High Performance Drupal Sites with Mercury on Ubuntu 10.04 (Lucid)

DZone.com: Sencha Touch 2 Models - Loading And Saving Model Data Using a Proxy, PHP Example

Michael Girouard's Blog: FIEO with PHP 5 Interceptors


Community Events

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


threedevsandamaybe laravel5 extension introduction framework api language laravel interview library community unittest voicesoftheelephpant series opinion development feature wordpress release podcast

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