HH\Iterable::zip

Returns an Iterable where each element is a Pair that combines the element of the current Iterable and the provided Traversable.

Description

public function zip(
  Traversable<Tu> $traversable,
): Iterable<Pair<Tv,Tu>>

Returns an Iterable where each element is a Pair that combines the element of the current Iterable and the provided Traversable.

If the number of elements of the Iterable are not equal to the number of elements in the Traversable, then only the combined elements up to and including the final element of the one with the least number of elements is included.

Parameters

  • Traversable<Tu> $traversable - The Traversable to use to combine with the elements of the current Iterable.

    @return - The Iterable that combines the values of the current Itearable with the provided Traversable.