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 foo(iterable $iterable) {
    foreach ($iterable as $value) {
        // ...
    }
}

?>

Documentation

See also Master PHP Iterables: Arrays, Objects, Traversable Interface and PHP Iterators for walking through data structures – FastTips.

Related : Traversable, Array, Pseudo-type, count(), PHP Natives, Pseudo-type, Special Types, ArrayAccess

Added in PHP 7.1