SPL, not a bridge too far

Embed Size (px)

Text of SPL, not a bridge too far

  1. 1. SPL, not a bridge too far Dutch PHP Conference 2009 - Amsterdam
  2. 2. Who am I ?Michelangelo van Dam Independent Enterprise PHP consultant @dragonbehttp://dragonbe.com 2
  3. 3. Who are you ?You know OOP ? You know php.net ?You know arrays ?3
  4. 4. What is SPL ? Standard PHP Libraryinterfaces, classes and methodssolve common development problemsAs of 5.3 SPL cannot be turned off from the source ! 4
  5. 5. Why use SPL ? SPL provides a huge toolkit that assists you to easily iterate over a diversity of data structures in a standardized way 5
  6. 6. What does it provide ? ArrayObject - approach arrays as objects Iterators - various iterators Interfaces - Countable Interface Exceptions - exceptions to streamline errorhandling SPL Functions - extra functions and autoloader func SplFileInfo - tools for lesystem access Datastructures - structuring data sequences 6
  7. 7. ArrayObject provides an interface - treat arrays as objects - elements are iteratable7
  8. 8. ArrayObject methods ArrayObject::append ArrayObject::__construct ArrayObject::count ArrayObject::getIterator ArrayObject::offsetExists ArrayObject::offsetGet ArrayObject::offsetSet ArrayObject::offsetUnset8
  9. 9.