Drop While

Remove elements from the start of an array while a condition is true.

Code

General
$idx = 0;
foreach ($arr as $i => $v) {
    if ($v >= $threshold) { $idx = $i; break; }
    if ($i === count($arr) - 1) { $idx = count($arr); }
}
return array_values(array_slice($arr, $idx));

Parameters

Array to process

Drop while less than threshold

Server

More PHP Snippets