PDA

View Full Version : Rounding using PHP



Cheap Bastard
June 23rd, 2001, 09:33
Here's my counter stats:


Total Visitors: 67897
Day: Visitors: Views:
Average 132.66666666667 276
20010623 45 77
20010622 224 484
20010621 129 267

should be rather obvious why i'd like some rounding

Either 3, 2, or no decimals (give your comments on which would be best)

Xyzzy
June 23rd, 2001, 12:05
$number = round (http://php.net/manual/en/function.round.php)($number, $precision);

Personally I prefer fractions over floating point (e.g. 398/3 instead of 132.6'), but using them would be a bit more work.

Cheap Bastard
June 23rd, 2001, 13:32
fractions don't seem that hard...

echo $original . "/" . $divider;

or ni my case
$count . "/" . $days;

anyway, thanks for that function (and the link).