May be I might be blind or silly, but look at my function:
function max_min_twenty($value) {
if ((int)$value == 0) {
return "0";
} else {
$percent_val = ((int)$value / 100) * 20;
$maxvalue = (int)$value + $percent_val;
$minvalue = (int)$value - $percent_val;
$returnvalue = round($minvalue)."-".round($maxvalue);
return $returnvalue;
}
}
Seems that this is really easy! It works like it should, but if my $value is 1500000 it gives me back 1,2E+6 for $minvalue - It does well if I choose a different number or if I change the percent to 19 or 21. Whats that?
Its running on PHP Version 5.2.4-2ubuntu5.27