Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Find lowest value
<?php min(mixed $value, mixed ...$values): mixed
<?php $collectionCount = $this->count();
foreach (range(1, min($count, $collectionCount)) as $item) {
array_push($results, array_pop($this->items));
}
<?php $collectionCount = $this->count();
foreach (range(1, min($count, $collectionCount)) as $item) {
array_push($results, array_shift($this->items));
}
<?php $position = ($position + 1) % $limit;
}
for ($i = 0, $end = min($limit, count($ringBuffer)); $i < $end; $i++) {
$pointer = ($position + $i) % $limit;
yield $ringBuffer[$pointer][0] => $ringBuffer[$pointer][1];
}
<?php : '';
$runTimeWidth = mb_strlen($runTime);
$width = min(terminal()->width(), 150);
$dots = max($width - $descriptionWidth - $runTimeWidth - 10, 0);
$this->output->write(str_repeat('<fg=gray>.</>', $dots), false, $verbosity);
<?php Str::slug($page['title'], ' '),
Str::slug($search, ' '),
))
->filter(fn ($score) => $score >= min(3, Str::length($search)))
->sortDesc()
->keys()
->sortByDesc(fn ($slug) => Str::contains(
<?php Str::slug($section['title'], ' '),
Str::slug($this->argument('section'), ' '),
))
->filter(fn ($score) => $score >= min(3, Str::length($this->argument('section'))))
->sortDesc()
->keys()
->sortByDesc(fn ($slug) => Str::contains(
<?php [$outputCount, $outputStartingPoint] = [
count($this->process->output),
min($this->nextOutputIndex, $this->nextErrorOutputIndex),
];
for ($i = $outputStartingPoint; $i < $outputCount; $i++) {
<?php public static function clamp(int|float $number, int|float $min, int|float $max)
{
return min(max($number, $min), $max);
}
<?php for ($i = 0; $i < 100; $i++) {
$lengths[] = strlen($e->encrypt('foo'));
}
$this->assertSame(min($lengths), max($lengths));
}
public function testWithCustomCipher()
<?php $this->assertCount(2, $random);
$this->assertCount(2, array_intersect_assoc($random->all(), $data->all()));
$random = $data->random(fn ($items) => min(10, count($items)));
$this->assertInstanceOf($collection, $random);
$this->assertCount(6, $random);
<?php $this->assertInstanceOf($collection, $random);
$this->assertCount(6, $random);
$random = $data->random(fn ($items) => min(10, count($items) - 1), true);
$this->assertInstanceOf($collection, $random);
$this->assertCount(5, $random);
$this->assertCount(5, array_intersect_assoc($random->all(), $data->all()));
<?php [$sum, $max, $min] = $data->reduceSpread(function ($sum, $max, $min, $value) {
$sum += $value;
$max = max($max, $value);
$min = min($min, $value);
return [$sum, $max, $min];
}, 0, PHP_INT_MIN, PHP_INT_MAX);