| InterfacesTable of Contents
 SPL provides a set of interfaces. See also the Predefined Interfaces and Classes Interface list
 The Countable interfaceIntroductionClasses implementing Countable can be used with the count function. Interface synopsisCountable 
     
       class Countable
     
     { /* Methods */ 
   abstract public int count
    ( void
   )} The OuterIterator interfaceIntroductionClasses implementing OuterIterator can be used to iterate over iterators. Interface synopsisOuterIterator 
     
       class OuterIterator
     
     
      extends
       Iterator
     
     { /* Methods */ 
   public Iterator getInnerIterator
    ( void
   ) /* Inherited methods */ 
   abstract public mixed Iterator::current
    ( void
   ) 
   abstract public scalar Iterator::key
    ( void
   ) 
   abstract public void Iterator::next
    ( void
   ) 
   abstract public void Iterator::rewind
    ( void
   ) 
   abstract public boolean Iterator::valid
    ( void
   )} The RecursiveIterator interfaceIntroductionClasses implementing RecursiveIterator can be used to iterate over iterators recursively. Interface synopsisRecursiveIterator 
     
       class RecursiveIterator
     
     
      extends
       Iterator
     
     { /* Methods */ 
   public RecursiveIterator getChildren
    ( void
   ) 
   public bool hasChildren
    ( void
   ) /* Inherited methods */ 
   abstract public mixed Iterator::current
    ( void
   ) 
   abstract public scalar Iterator::key
    ( void
   ) 
   abstract public void Iterator::next
    ( void
   ) 
   abstract public void Iterator::rewind
    ( void
   ) 
   abstract public boolean Iterator::valid
    ( void
   )} The SeekableIterator interfaceIntroductionThe Seekable iterator. Interface synopsisSeekableIterator 
     
       class SeekableIterator
     
     
     
      extends
       Iterator
     
     { /* Methods */ 
   abstract public void seek
    ( int  $position)/* Inherited methods */ 
   abstract public mixed Iterator::current
    ( void
   ) 
   abstract public scalar Iterator::key
    ( void
   ) 
   abstract public void Iterator::next
    ( void
   ) 
   abstract public void Iterator::rewind
    ( void
   ) 
   abstract public boolean Iterator::valid
    ( void
   )} Example #1 Basic usage This example demonstrates creating a custom SeekableIterator, seeking to a position and handling an invalid position. 
<?phpThe above example will output something similar to: first element third element second element invalid seek position (10) |