Back to index

php5  5.3.10
SPL - Standard PHP Library

SPL - Standard PHP Library SPL is a collection of interfaces and classes that are meant to solve standard problems and implements some efficient data access interfaces and classes. You'll find the classes documented using php code in the file spl.php or in corresponding .inc files in subdirectories examples and internal. Based on the internal implementations or the files in the examples subdirectory there are also some .php files to experiment with.

The .inc files are not included automatically because they are sooner or later integrated into the extension. That means that you either need to put the code of examples/ into your autoprepend file or that you have to point your ini setting auto_prepend_file to that file.

Below is a list of interfaces/classes already availabel natively through the SPL extension grouped by category.

1) Iterators

SPL offers some advanced iterator algorithms:

2) Directories and Files

SPL offers two advanced directory and file handling classes:

3) XML

SPL offers an advanced XML handling class:

4) Array Overloading

SPL offers advanced Array overloading:

As the above suggest an ArrayObject creates an ArrayIterator when it comes to iteration (e.g. ArrayObject instance used inside foreach).

5) Counting

6) Exceptions

SPL provides a set of standard Exception classes each meant to indicate a certain problem type.

7) Observer

SPL suggests a standard way of implementing the observer pattern.

8) Datastructures

SPL proposes a set of datastructures implemented internally.

9) Example classes

The classes and interfaces in this group are contained as PHP code in the examples subdirectory of ext/SPL. Sooner or later they will be moved to c-code.

10) Some articles about SPL:

11) Talks on SPL:

12) Debug sessions:

You can download this documentation as a chm file here.

(c) Marcus Boerger, 2003 - 2007