When a class implements the ArrayAccess interface, it becomes ready to function as an array, complete with OffsetGet, OffsetSet and so on.
ArrayAccess
One thing I d
The correct way would be to implement the Countable interface
Example #1 Countable::count() example
In other words, you implement the logic what count() should return yourself.
count()