News Feed
Sections




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

PHPMaster.com:
Using SPL Iterators, Part 1
May 15, 2012 @ 12:26:59

On PHPMaster.com today there's a new tutorial posted, the first part of a series, looking at the use of the Standard PHP Library (SPL) in PHP. In this first part of the series, Stefan Froelich looks specifically at two of the more common uses for iterators - working with arrays and directories.

When I first came across the term iteration and saw the overwhelming list of classes related to it in the SPL, I was taken aback. It seemed maybe iteration was too complex for me to grasp. I soon realized it was just a fancy word for something we programmers do all the time. [...] In the first part of this two-part series I'll introduce you to iteration and how you can take advantage of some of the built-in classes from the Standard PHP Library (SPL).

Included in the tutorial is example code showing how to use the ArrayIterator to work with an array and the DirectoryIterator to process the contents of a directory. He also briefly touches on a few other iterators like "FileExtensionFilter", "RecursiveDirectoryIterator" and "RecursiveArrayIterator".

0 comments voice your opinion now!
spl iterators tutorial array directory file recursive


blog comments powered by Disqus

Similar Posts

Jani Hartikainen's Blog: How to use built-in SPL exception classes for better error handling

DevShed: Fetching Search Results as Serialized Arrays with Yahoo Web Services and PHP 5

SitePoint.com: Be More Asssertive: Getting to Know PHPUnit's Assertions

PHPMaster.com: Sending Emails with PHP

Gary Hokin: An Introduction to Zend Framework 2 for the Zend Framework 1 Developer - Part 1


Community Events

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


release symfony opinion library community security interview version laravel5 podcast series language threedevsandamaybe unittest laravel extension framework api introduction voicesoftheelephpant

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