<?php
$current = array(
750 => 2,
1000 => 1.3
2000 => 1.2
3000 => 1.1
4000 => 1.0
5000 => 0.9
6000 => 0.8
10000 => 0.75
);
function update($current) {
$tiers = array(
0 => 3.5,
250 => 3.5,
500 => 3.5,
750 => 3,
);
krsort($current);
$prev = 0;
foreach($current as $range => $spread) {
if ( $range < 1000 )
continue;
if ( $range >= 1000 && $range <= 5000 && $spread <= 1.1 )
$spread += 0.4;
$prev = $tiers[$range] = max($spread, $prev);
}
ksort($tiers);
return $tiers;
}
var_dump($current);
var_dump(update($current));
- Output for 5.4.0 - 5.4.22
- Parse error: syntax error, unexpected '2000' (T_LNUMBER), expecting ')' in /in/O3TcD on line 6
Process exited with code 255. - Output for 5.3.0 - 5.3.27
- Parse error: syntax error, unexpected T_LNUMBER, expecting ')' in /in/O3TcD on line 6
Process exited with code 255.
preferences:
182.68 ms | 1395 KiB | 58 Q