If I have a class that implements the Iterator interface, I can manually control how iteration in a foreach loop. But are there other ways in which
From PHP
Introduction
Interface for external iterators or objects that can be iterated themselves internally.
As you can see from the interface Table of Contents ¶
Iterator::current — Return the current element
Iterator::key — Return the key of the current element
Iterator::next — Move forward to next element
Iterator::rewind — Rewind the Iterator to the first element
Iterator::valid — Checks if current position is valid
The operation is designed for forward iteration. So reverse would naturally not work and is not designed for this.
For more array-object related interfaces take a look at. ArrayAccess and Countable
For a solution upon a reverse object iterator take a look at the answer here Iterate in reverse through an array with PHP - SPL solution?