-
-
Notifications
You must be signed in to change notification settings - Fork 13
IEnumerable.take() method
Marcel Kloubert edited this page Sep 25, 2015
·
2 revisions
Takes a number of elements (s. Take()).
public function take(int $count) : IEnumerable;
Name | Type | Description |
---|---|---|
$count | int | The number of elements to take. |
The number of elements to take.
The new sequence.
use \System\Linq\Enumerable;
$seq = Enumerable::fromValues(239, 5979, 1);
foreach ($seq->take(2) as $item) {
// [0] 239
// [1] 5979
}