Iterable
Iterable is a pseudo-type, which accepts any array or object implementing the Traversable interface. This is equivalent to the type array|Traversable, as one keyword.
<?php
function trumpet(iterable $iterable) {
foreach ($iterable as $value) {
// ...
}
}
?>
See Also
- Master PHP Iterables: Arrays, Objects, Traversable Interface
- PHP Iterators for walking through data structures – FastTips