jump to navigation

SPL : A hidden gem in PHP April 17, 2011

Posted by Tournas Dimitrios in PHP.

SPL, or Standard PHP Library, is a set of classes and interfaces built in to PHP since version 5.0, and as of PHP 5.3 it cannot even be disabled, so its here and for good. Its actually hard to disable it when compiling, so 9.9 out of 10 changes that you have it. But why have you not used it? The answer begins at “poor documentation” and ends in “didn’t even know it existed”, SPL has not had the “bling” about that it deserves .
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. 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.  SPL deals very well with Iterators . An Iterator is an object that traverses a structure eg: an array or a directory listing or possibly a set of database result sets or other resource. What is important to note is they can all be accessed with a standard interface. This means that regardless of the data type, access to the information is standardised.

Read more on the following links :


No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s