blob: dff015e2c13f33fbf12a647585360cf730f75d27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
This is an extension that aims to implement some efficient data access
interfaces and classes. You'll find the classes documented using php
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.
The .inc files are not included automatically because the are sooner or
later integrated into the extension. That means that you either need to
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.
1) Iterators
SPL offers some advanced iterator algorithms:
interface RecursiveIterator implements Iterator
class RecursiveIteratorIterator implements Iterator
abstract class FilterIterator implements Iterator
class ParentIterator extends FilterIterator implements RecursiveIterator
2) Directories
SPL offers two advanced directory classes.
class DirectoryIterator implements Iterator
class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator
3) XML
SPL offers an advanced XML handling class.
class SimpleXMLIterator extends simplexml_element extends recursiveiterator
4) Array Overloading
SPL offers advanced Array overloading.
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).
|