crowdstar/ranger

Ranger allows you to mimic the range function in PHP as an Iterator, conserving memory for large ranges.

1.0.0 2019-03-21 23:48 UTC

This package is auto-updated.

Last update: 2022-06-26 02:01:27 UTC


README

Build Status

Ranger allows you to mimic the range function in PHP as an Iterator, conserving memory for large ranges.

Installation

composer require crowdstar/ranger:~1.0.0

Sample Usage

Old way

<?php

foreach (range(1, 100000) as $number) {
    echo $number;
}

New way

<?php

use CrowdStar\Iterators\Ranger;

$range = Ranger::start(1, 100000);

foreach ($range as $number) {
	echo $number;
}