Drop

Drop ( int $amount )

Discards the first amount input values, returning the remaining values.

Parameters

amount
The amount of input values that should be discarded.

Examples

Example #1

Basic usage example.

<?php
use Webbhuset\Pipeline\Constructor as F;

$drop = F::Drop(2);

$input = [1, 3, 5, 7, 9];

echo json_encode(iterator_to_array($drop($input)));

// Output: [5,7,9]

See Also

  • DropWhile - Discard input values while a callback function returns true.
  • Filter - Discard input values based on a callback function.
  • Take - Return a specific amount of input values.