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

PHPBuilder.com:
Using SPL Iterators in PHP to Interact with Different Data Types
Mar 17, 2011 @ 15:34:09

On PHPBuilder.com today there's a new tutorial from Jason Gilmore about using the SPL with different data types to more effectively work with them more effectively.

One great way to incorporate more OOP into your applications is through the Standard PHP Library (SPL), a powerful yet largely unknown extension made part of the official PHP language with the PHP 5.0 release. [...] In this tutorial I'll introduce you to several of my favorite SPL iterators, providing you with the basis from which you can continue your own exploration. Following several examples, I'll conclude with a brief introduction to other key SPL features.

He looks at how to use the ArrayIterator, DirectoryIterator, SimpleXMLIterator and mentions some of the other handlers for things like advanced data structures, exceptions and more file handling.

tagged: spl standardphplibrary tutorial arrayiterator directoryiterator simplexmliterator

Link:

PHPro.org:
Introduction to Standard PHP Library (SPL)
Nov 03, 2008 @ 17:19:58

Kevin Waterson has posted a new tutorial to the PHPro.org website today - a pretty comprehensive look at the DirectoryIterator in the Standard PHP Library (SPL).

SPL provides a standard set of interfaces for PHP5. The aim of SPL is to implement some efficient data access interfaces and classes for PHP. Functionally it is designed to traverse aggregate structures (anything you want to loop over). These may include arrays, database result sets, xml trees, directory listings or any list at all. Currently SPL deals with Iterators.

He looks at functionality like the Directory Iterator, getting the file owner, checking to see if a file is valid and how to rewind an iterator.

tagged: spl standard library tutorial introduction directoryiterator

Link:

Builder.com.au:
How do I...recursively scan directories with PHP's DirectoryIterators?
Jun 18, 2008 @ 12:55:21

Builder.com.au has a new tutorial posted today talking about the use if Iterators (from PHP's SPL) to recurse down through directories on your local drive.

One of PHP5's most interesting new features is the addition of Iterators, a collection of ready-made interfaces designed to help in navigating and processing hierarchical data structures. These Iterators significantly reduce the amount of code required to process an XML document tree or a file collection.

They give three examples - two basic ones showing a simple use of the DirectoryIterator and RecursiveDirectoryIterator and another slightly more complex one showing how to get information from the recursive iteration as it goes down.

tagged: directoryiterator iterator recursive directory example

Link:

DevShed:
Working with Directory Iterators and Proxy Classes with PHP 5
Jan 09, 2007 @ 19:21:05

DevShed is wrapping up their "Building Proxy Classes with PHP5" series today with this last tutorial about working with directory iterators and proxy classes.

Since in the first part of the series I showed you how to create a proxy class for processing simple XML strings, in this installment I'm going to teach you how to create a proxy object that can be used in conjunction with the "DirectoryIterator" class that comes with PHP 5.

They start with the definition of a proxy class, the base to start from, and improve its functionality through additional methods like getSize, getPath, and getTimeStamps (using the iterators). The complete the development by pulling the parts together and creating a final example that loops through a given path and displays various info about the directory/files inside (size, names, timestamp, etc).

tagged: proxy class directoryiterator size timestamp tutorial class proxy class directoryiterator size timestamp tutorial class

Link:

DevShed:
Working with Directory Iterators and Proxy Classes with PHP 5
Jan 09, 2007 @ 19:21:05

DevShed is wrapping up their "Building Proxy Classes with PHP5" series today with this last tutorial about working with directory iterators and proxy classes.

Since in the first part of the series I showed you how to create a proxy class for processing simple XML strings, in this installment I'm going to teach you how to create a proxy object that can be used in conjunction with the "DirectoryIterator" class that comes with PHP 5.

They start with the definition of a proxy class, the base to start from, and improve its functionality through additional methods like getSize, getPath, and getTimeStamps (using the iterators). The complete the development by pulling the parts together and creating a final example that loops through a given path and displays various info about the directory/files inside (size, names, timestamp, etc).

tagged: proxy class directoryiterator size timestamp tutorial class proxy class directoryiterator size timestamp tutorial class

Link:

DevShed:
Finding Paths, Timestamps and More with the DirectoryIterator Class in PHP
Sep 18, 2006 @ 13:21:51

DevShed continues its look at the DirectoryIterator functionality in PHP5 with the second part of the series today - "Finding Paths, Timestamps and More with the DirectoryIterator Class in PHP".

Are you interested in having at your disposal a quick reference for working with the "DirectoryIterator" class that comes with PHP 5? Then this might be the article that you’ve been waiting for! Welcome to the second tutorial of the series "A Close Look at the DirectoryIterator Class in PHP 5." Over the course of this set of installments, you'll find complete coverage of the most important methods bundled with this class, and learn how to take advantage of their excellent functionality.

They cover even more functions in this part:

  • rewind, current, valid
  • getFileName, isFile
  • getMTime, getATime, getCTime
  • getPath, getPathName
Each set is supported by code and explaination to help introduce their concepts in a useful way.

tagged: tutorial directoryiterator methods part2 path timestamp file tutorial directoryiterator methods part2 path timestamp file

Link:

DevShed:
Finding Paths, Timestamps and More with the DirectoryIterator Class in PHP
Sep 18, 2006 @ 13:21:51

DevShed continues its look at the DirectoryIterator functionality in PHP5 with the second part of the series today - "Finding Paths, Timestamps and More with the DirectoryIterator Class in PHP".

Are you interested in having at your disposal a quick reference for working with the "DirectoryIterator" class that comes with PHP 5? Then this might be the article that you’ve been waiting for! Welcome to the second tutorial of the series "A Close Look at the DirectoryIterator Class in PHP 5." Over the course of this set of installments, you'll find complete coverage of the most important methods bundled with this class, and learn how to take advantage of their excellent functionality.

They cover even more functions in this part:

  • rewind, current, valid
  • getFileName, isFile
  • getMTime, getATime, getCTime
  • getPath, getPathName
Each set is supported by code and explaination to help introduce their concepts in a useful way.

tagged: tutorial directoryiterator methods part2 path timestamp file tutorial directoryiterator methods part2 path timestamp file

Link:

DevShed:
Main Methods of the DirectoryIterator Class in PHP 5
Sep 11, 2006 @ 13:32:06

DevShed is starting up another new series today, this time looking at the DirectoryIterator methods out of the Standard PHP Library functionality.

Because this class might be handy to use in projects where handling directories is a must, in this new series I'll be taking a close look at some of its most important methods. We will explore these methods appropriately in conjunction with the corresponding code samples.

They introduce the class, noting why it's handy to use and where's the best place to use it - including an example. They get into a bit more detail, looking at the key() and current() methods as well as using the rewind() method to reset the pointer for the directory.

tagged: directoryiterator class php5 standard library tutorial part1 directoryiterator class php5 standard library tutorial part1

Link:

DevShed:
Main Methods of the DirectoryIterator Class in PHP 5
Sep 11, 2006 @ 13:32:06

DevShed is starting up another new series today, this time looking at the DirectoryIterator methods out of the Standard PHP Library functionality.

Because this class might be handy to use in projects where handling directories is a must, in this new series I'll be taking a close look at some of its most important methods. We will explore these methods appropriately in conjunction with the corresponding code samples.

They introduce the class, noting why it's handy to use and where's the best place to use it - including an example. They get into a bit more detail, looking at the key() and current() methods as well as using the rewind() method to reset the pointer for the directory.

tagged: directoryiterator class php5 standard library tutorial part1 directoryiterator class php5 standard library tutorial part1

Link:

JellyandCustard.com:
Using DirectoryIterator to List Files in PHP
May 23, 2006 @ 17:12:12

From JellyandCustard.com today, there's a good example of creating and using a DirectoryIterator instance to loop through the files in a directory.

During the days of PHP4, the most common way of showing the files in a directory was like so [opendir, readdir, closedir]. However, if your PHP version has now been upgraded to PHP 5, you can take advantage of DirectoryIterator instead. This class (don't get scared) is part of the SPL library that is now bundled within PHP 5.

They describe the functionality and provide a simple example of its use. Also included are the other functions you can use with the resulting file handles to make for a cleaner interface in your script. They also include two examples of its usage with the output it would give - getting some stats on selected files.

tagged: directoryiterator standard library php5 tutorial example directoryiterator standard library php5 tutorial example

Link:


Trending Topics: