2003-05-02 03:09:58 +00:00
|
|
|
This is an extension that aims to implement some efficient data access
|
2003-06-23 22:37:12 +00:00
|
|
|
interfaces and classes. You'll find the classes documented using php
|
2003-12-04 19:39:46 +00:00
|
|
|
code in the file spl.php or in the corresponding .inc file in the examples
|
|
|
|
subdirectory. Based on the internal implementations or the files in the
|
|
|
|
examples subdirectory there are also some .php files to experiment with.
|
2003-05-02 03:09:58 +00:00
|
|
|
|
2004-03-09 17:47:28 +00:00
|
|
|
The .inc files are not included automatically because they are sooner or
|
2004-01-10 23:49:26 +00:00
|
|
|
later integrated into the extension. That means that you either need to
|
2003-12-04 19:39:46 +00:00
|
|
|
put the code of examples/autoload into your autoprepend file or that you
|
|
|
|
have to point your ini setting auto_prepend_file to this file.
|
2003-05-02 03:09:58 +00:00
|
|
|
|
2004-03-09 17:47:28 +00:00
|
|
|
Below is a list of interfaces/classes already availabel natively through
|
|
|
|
the SPL extension grouped by category. For more information refer to the
|
|
|
|
docuement spl.php.
|
|
|
|
|
2003-06-23 22:37:12 +00:00
|
|
|
1) Iterators
|
2003-05-02 03:09:58 +00:00
|
|
|
|
2004-01-10 23:49:26 +00:00
|
|
|
SPL offers some advanced iterator algorithms:
|
2003-06-23 22:37:12 +00:00
|
|
|
|
2003-12-04 19:39:46 +00:00
|
|
|
interface RecursiveIterator implements Iterator
|
|
|
|
class RecursiveIteratorIterator implements Iterator
|
|
|
|
abstract class FilterIterator implements Iterator
|
|
|
|
class ParentIterator extends FilterIterator implements RecursiveIterator
|
2004-03-09 17:47:28 +00:00
|
|
|
interface SeekableIterator implements Iterator
|
|
|
|
class LimitIterator implements Iterator
|
|
|
|
class CachingIterator implements Iterator
|
|
|
|
class CachingRecursiveIterator extends CachingIterator implements RecursiveIterator
|
2003-06-23 22:37:12 +00:00
|
|
|
|
2003-12-04 19:39:46 +00:00
|
|
|
2) Directories
|
2003-06-23 22:37:12 +00:00
|
|
|
|
2004-03-09 17:47:28 +00:00
|
|
|
SPL offers two advanced directory classes:
|
2003-06-23 22:37:12 +00:00
|
|
|
|
2003-12-04 19:39:46 +00:00
|
|
|
class DirectoryIterator implements Iterator
|
|
|
|
class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator
|
2004-03-09 17:01:21 +00:00
|
|
|
|
|
|
|
3) XML
|
|
|
|
|
2004-03-09 17:47:28 +00:00
|
|
|
SPL offers an advanced XML handling class:
|
2004-03-09 17:01:21 +00:00
|
|
|
|
|
|
|
class SimpleXMLIterator extends simplexml_element extends recursiveiterator
|
|
|
|
|
|
|
|
4) Array Overloading
|
|
|
|
|
2004-03-09 17:47:28 +00:00
|
|
|
SPL offers advanced Array overloading:
|
2004-03-09 17:01:21 +00:00
|
|
|
|
|
|
|
class ArrayObject implements IteratorAggregate
|
|
|
|
class ArrayIterator implements Iterator
|
|
|
|
|
|
|
|
As the above suggest an ArrayObject creates an ArrayIterator when it comes to
|
|
|
|
iteration (e.g. ArrayObject instance used inside foreach).
|