Background This article demonstrates how to implement and use the Countable interface in PHP. The Countable interface is normally used in conjunction with other interfaces (i.e., Iterator, ArrayAccess, etc.) to create data structures like PHP SPL Library’s SplDoublyLinkedList and SplStack.
How to use the Iterator interface in PHP
This article demonstrates how to use the Iterator interface in PHP. Objects implementing this interface works like an array when used in foreach constructs.
How foreach Interacts with Iterator interface
How foreach Interacts with Iterator interface