If you want to design a class and make it's behavior as an array, you may extend ArrayObject. Also this new class probably need to use an instance of class which extends ArrayIterator (Note: ArrayIterator is a class, not an interface).
This feature requires PHP 5.
The statement foreach ($arrayobject as $k => $v) {...} means:
Note: A native array could be iterate by reference. For example: foreach ($array as $k => &$v). But an instance of ArrayIterator can not do that. Cause the value of iteration is return from method ArrayIterator::current() which prototype is not a reference.
The following codes shows how to overload indexer and foreach structure in PHP5.