If you don’t know SPL basics, this talk might go fast for you.
Please rate me - Feedback is good!
Why SPL? What SPL? How SPL? A library of standard interfaces, classes, and functions designed to solve common programming problems and allow engine overloading
BUT ISN’T SPL AN EXTENSION? SPL is an extension SPL is a core extension SPL cannot be built shared SPL should not be turned off SPL is present in PHP since 5.0 (almost 5 years ago) As of 5.3, SPL cannot be turned off
If you don’t have SPL, whoever built your PHP is an idiot.
SPECIFICALLY ARRAYOBJECT Implements ArrayAccess (with references) Implements Countable Implements IteratorAggregate Implements Serializable (since 5.3.0) And other methods that arrays can use (but not all)
SPLSUBJECT SPLOBSERVER Are you implementing the observer pattern in your code? Do you intend to have other people use your code/library in some way? Are you implementing something LIKE the observer pattern?
MORE EXIST ParentIterator NoRewindIterator MultipleIterator GlobIterator CallbackFilterIterator RecursiveCallbackFilterIterator
New ways of managing data DATASTRUCTURES
DOUBLYLINKEDLISTS – CS LESSON ordered collection of values linked to each element before it linked to each element after it “doubly linked”
PHP datastructure – a php object with a doublylinkedlist stored inside it
SPLDOUBLYLINKEDLIST Don’t use this Yes, that’s a terrible thing to say – but this is really nothing more then a “base class” with little to recommend on its own Has a doublylinkedlist from C underneath instead of a hashtable – if you know what that means you may find a real use for this (I have not)
SPLFIXEDARRAY You have a large amount of data, you know the final size, you need to stick it into an array You’re not going to expand it past the final size This is not a small amount of data You might need it in non-sequential order but can handle having only integers for keys