hphp/hack/manual/apis/Interfaces/HH/Iterable/index.md
:::info[Note] This is a point-in-time snapshot of the API documentation from January 2026. Going forward, we will not be maintaining a public copy of these references, and recommend users to refer to the built-in signature helpers available in the Hack LSP instead for complete and up-to-date information. :::
Represents any entity that can be iterated over using something like
foreach
The entity does not necessarily have to have a key, just values.
Iterable does not include arrays.
namespace HH;
interface Iterable implements Traversable<Tv>, \IteratorAggregate<Tv> {...}
->concat<Tu super Tv>(Traversable<Tu> $traversable): Iterable<Tu>Iterable that is the concatenation of the values of the
current Iterable and the values of the provided Traversable->filter((function(Tv): bool) $fn): Iterable<Tv>Iterable containing the values of the current Iterable that
meet a supplied condition->firstValue(): ?TvIterable->getIterator(): Iterator<Tv>Iterable->lastValue(): ?TvIterable->lazy(): Iterable<Tv>Iterable->map<Tu>((function(Tv): Tu) $fn): Iterable<Tu>Iterable containing the values after an operation has been
applied to each value in the current Iterable->skip(int $n): Iterable<Tv>Iterable containing the values after the n-th element of the
current Iterable->skipWhile((function(Tv): bool) $fn): Iterable<Tv>Iterable containing the values of the current Iterable
starting after and including the first value that produces true when
passed to the specified callback->slice(int $start, int $len): Iterable<Tv>Iterable starting from a given key up
to, but not including, the element at the provided length from the
starting key->take(int $n): Iterable<Tv>Iterable containing the first n values of the current
Iterable->takeWhile((function(Tv): bool) $fn): Iterable<Tv>Iterable containing the values of the current Iterable up
to but not including the first value that produces false when passed to
the specified callback->toImmSet(): ImmSet<Tv>ImmSet) converted from the current Iterable->toImmVector(): ImmVector<Tv>ImmVector) converted from the current
Iterable->toValuesArray(): varray<Tv>array with the values from the current Iterable->values(): Iterable<Tv>Iterable containing the current Iterable's values->zip<Tu>(Traversable<Tu> $traversable): Iterable<Pair<Tv, Tu>>Iterable where each element is a Pair that combines the
element of the current Iterable and the provided Traversable