O'Reilly logo

Mastering the SPL Library by Joshua Thijssen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Available SPL Data Structures

In this chapter, we will discuss all the SPL data structures that are currently available in PHP v5.4. Some of them are based on other data structures, for instance, the SplMinHeap and SplMaxHeap are extended classes from the SplHeap while SplStack and SplQueue are extended from SplDoublyLinkedList.

All these data structures all implement the Iterator and Countable interface, which means all data structures are countable (count() will return the number of elements inside the structure) and they are traversable with foreach(), but not every structure is really fitting for iteration as I will show you later on.

Most of them also implement the ArrayAccess interface so they can also be used as an array by accessing elements ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required