Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Create an array containing a range of elements
range(string|int|float $start, string|int|float $end, int|float $step = 1): array
public static function range($from, $to)
{
return new static(range($from, $to));
}
{
return new static(range($from, $to));
}
$collectionCount = $this->count();
foreach (range(1, min($count, $collectionCount)) as $item) {
array_push($results, array_pop($this->items));
}
foreach (range(1, min($count, $collectionCount)) as $item) {
array_push($results, array_pop($this->items));
}
$collectionCount = $this->count();
foreach (range(1, min($count, $collectionCount)) as $item) {
array_push($results, array_shift($this->items));
}
foreach (range(1, min($count, $collectionCount)) as $item) {
array_push($results, array_shift($this->items));
}
return array_map(function () use ($attributes, $parent) {
return $this->state($attributes)->getExpandedAttributes($parent);
}, range(1, $this->count));
}
return $this->state($attributes)->getExpandedAttributes($parent);
}, range(1, $this->count));
}
$instances = $this->newModel()->newCollection(array_map(function () use ($parent) {
return $this->makeInstance($parent);
}, range(1, $this->count)));
$this->callAfterMaking($instances);
return $this->makeInstance($parent);
}, range(1, $this->count)));
$this->callAfterMaking($instances);
public function getUrlRange($start, $end)
{
return collect(range($start, $end))->mapWithKeys(function ($page) {
return [$page => $this->url($page)];
})->all();
}
{
return collect(range($start, $end))->mapWithKeys(function ($page) {
return [$page => $this->url($page)];
})->all();
}
foreach ($ranges as $range) {
if (preg_match('/^[0-9]+\-[0-9]+$/', $range)) {
$ids = array_merge($ids, range(...explode('-', $range)));
}
}
if (preg_match('/^[0-9]+\-[0-9]+$/', $range)) {
$ids = array_merge($ids, range(...explode('-', $range)));
}
}
{
$slots = array_map(function ($i) {
return $this->name.$i;
}, range(1, $this->maxLocks));
return $this->redis->eval(...array_merge(
[$this->lockScript(), count($slots)],
$slots = array_map(function ($i) {
return $this->name.$i;
}, range(1, $this->maxLocks));
return $this->redis->eval(...array_merge(
[$this->lockScript(), count($slots)],
protected function forEachProcess($callback)
{
collect(range(1, $this->options->processes()))->each(function ($token) use ($callback) {
tap($this->createApplication(), function ($app) use ($callback, $token) {
ParallelTesting::resolveTokenUsing(fn () => $token);
{
collect(range(1, $this->options->processes()))->each(function ($token) use ($callback) {
tap($this->createApplication(), function ($app) use ($callback, $token) {
ParallelTesting::resolveTokenUsing(fn () => $token);
$previous = null;
foreach (range(0, 10) as $ignored) {
$this->assertNotSame($previous, $previous = $model->virtualString);
}
}
foreach (range(0, 10) as $ignored) {
$this->assertNotSame($previous, $previous = $model->virtualString);
}
}
$this->assertIsBool($first);
foreach (range(0, 10) as $ignored) {
$this->assertSame($first, $model->virtual_boolean_cached);
}
}
foreach (range(0, 10) as $ignored) {
$this->assertSame($first, $model->virtual_boolean_cached);
}
}
$this->assertSame(1, $model->virtualNullCalls);
foreach (range(0, 10) as $ignored) {
$this->assertSame($first, $model->virtual_null_cached);
}
foreach (range(0, 10) as $ignored) {
$this->assertSame($first, $model->virtual_null_cached);
}
$this->assertIsBool($first);
foreach (range(0, 50) as $ignored) {
$current = $model->virtual_boolean;
$this->assertIsBool($current);
foreach (range(0, 50) as $ignored) {
$current = $model->virtual_boolean;
$this->assertIsBool($current);
$previous = $model->virtualObject;
foreach (range(0, 10) as $ignored) {
$this->assertSame($previous, $previous = $model->virtualObject);
}
}
foreach (range(0, 10) as $ignored) {
$this->assertSame($previous, $previous = $model->virtualObject);
}
}
$previous = $model->virtualDateTime;
foreach (range(0, 10) as $ignored) {
$this->assertSame($previous, $previous = $model->virtualDateTime);
}
}
foreach (range(0, 10) as $ignored) {
$this->assertSame($previous, $previous = $model->virtualDateTime);
}
}