<?php
/*
* Class ArrayList
* It shows a simple usage of SPL
* This one is not part of dynamic object creation core classes
*/
class ArrayList implements IteratorAggregate {
private $object = array();
private $pointer = 0;
// This will return a Iterable objects
public function getIterator() {
return new ArrayIterator($this->object);
}
public function add($value) {
$this->object[$this->pointer++] = $value;
}
}
?>