News Feed
Sections




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

MaltBlue.com:
Painless Data Traversal with PHP FilterIterators
October 25, 2012 @ 08:54:35

On the MaltBlue blog Matt Setter has a new post introducing you to using FilterIterators for data traversal:

There's load of ways to traverse data, especially in PHP where there are a variety of loops available; including while, do while, for and foreach. These are fine for normal structures, such as scalar and associative arrays. But what if you want to get a bit more fancy?

He includes a bit of code showing the typical looping approach that a lot of developers take and how, using a FilterIterator, you can extend the default and make a custom "accept" method to remove certain matching items from the data set.

0 comments voice your opinion now!
filteriterator data traversal filter spl iterator array


blog comments powered by Disqus

Similar Posts

Jim Plush\'s Blog: AJAX, PHP and Javascript Errors - How to get more data

Brandon Savage's Blog: Designing Databases: Picking The Right Data Types

Jani Hartikainen's Blog: Decoupling models from the database: Data Access Object pattern in PHP

PHPMaster.com: Using SPL Iterators, Part 1

Nick Halstead's Blog: Bad code, bad data flow, good idea?


Community Events

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


release example community laravel unittest laravel5 podcast series extension opinion language php7 introduction api framework list version library voicesoftheelephpant interview

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