These objects simplify tasks and saves countless sleepless nights
for a lot of coders like me. Standard PHP Library (SPL) is a set of objects for PHP
developers introduced in PHP5. They come with a lot of interfaces and objects to
simplify your coding. In this chapter we will go through some of them and show you
their use.
Available Objects in SPL
You can find out the available objects in SPL by executing the following code.
// a simple foreach() to traverse the SPL class names
foreach(spl_classes() as $key=>$value)
{
echo $value."\n";
}
?>
The result will show you all the available classes in your current PHP install:
AppendIterator
ArrayIterator
ArrayObject
BadFunctionCallException
BadMethodCallException
CachingIterator
Countable
DirectoryIterator
DomainException
EmptyIterator
FilterIterator
Standard PHP Library
[ 142 ]
InfiniteIterator
InvalidArgumentException
IteratorIterator
LengthException
LimitIterator
LogicException
NoRewindIterator
OuterIterator
OutOfBoundsException
OutOfRangeException
OverflowException
ParentIterator
RangeException
RecursiveArrayIterator
RecursiveCachingIterator
RecursiveDirectoryIterator
RecursiveFilterIterator
RecursiveIterator
RecursiveIteratorIterator
RuntimeException
SeekableIterator
SimpleXMLIterator
SplFileObject
SplObjectStorage
SplObserver
SplSubject
UnderflowException
UnexpectedValueException
ArrayObject
This is a fantastic object introduced in SPL to simplify array operation and to
enrich the normal PHP array.
Pages:
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161