-
-
Notifications
You must be signed in to change notification settings - Fork 13
Enumerable.range() method
Marcel Kloubert edited this page Jan 26, 2015
·
2 revisions
Generates a new sequence of numbers within a specified range. (s. Range()).
public static Enumerable range(number $start, int $count [, mixed $increaseBy]);
Name | Type | Description |
---|---|---|
$start | number | The start value. |
$count | int | The number of items. |
$increaseBy | number|callable | [OPTIONAL] The value for increasing to next value or the function that provides that value. The DEFAULT value is 1. |
The new instance.
use \System\Linq;
// 1 - 10
$seq1 = Enumerable::range(1, 10);
// 2 - 20
$seq2a = Enumerable::range(2, 10, 2);
// other way to do this
$seq2b = Enumerable::range(2, 10,
function($currentValue, $index) {
return 1 + 1;
});