PHP has many predefined interfaces and classes that may be used in object model programming. The list below goes through some of them offering a breif explanation of their usage.

PHP based predefined interfaces and classes:

  • The Traversable Interface - Interface is used to detect if a class is traversable using foreach. It must be implemented using “IteratorAggregate” or “Iterator”.
  • Iterator - Interface for external iterators or objects that can be iterated internally.
  • IteratorAggregate - Interface to create an external iterator.
  • Array Access Interface - Interface to provide accessing object as array.
  • The Serializable Interface - Interface for customizing serializing.
  • The Closure Class - Class used to represent anonymous functions.
  • The Generator Class - Objects used to represent those returned from object generators.


›› go to examples ››