Home >Backend Development >PHP Tutorial >php—Traversable interface
Introduction
An interface to detect whether a class can be traversed using foreach.
Basic abstract interface that cannot be implemented alone. Instead it must be implemented by the IteratorAggregate or Iterator interface.
Note:
Built-in classes that implement this interface can use foreach for traversal without implementing the IteratorAggregate or Iterator interface.
Note:
This is an internal engine interface that cannot be implemented in PHP scripts. The IteratorAggregate or Iterator interface can be used instead.
Interface summary
Traversable {
}
This interface does not have any methods, its role is only as the basic interface for all traversable classes.