For example say there is a numeric array (let's assume it's k sorted already) keyed by unix timestamps with integer values.
$array = [
312345678 => 1,
312345692 => 4,
312345703 => 33,
.... etc.
];
and you needed an array sum of all the values from unix time 310284763 (which may or may not be a key in the array) to 338672926 (which may or may not be a key in the array).
Obviously you could do something unperformative like:
$total = 0;
foreach($array as $time => $value){
if($time < $min){continue;}
if($time > $max){break;}
$total += $value;
}
But is there a nice way of extracting a "range" of a numeric array?