Page 1 of 1

[resolved] Rounding Numbers

Posted: Fri Jul 28, 2006 12:04 pm
by ibanez270dx
Hi,
Little quick question, I'm kinda pressed for time... My script has a section where it calculates an uptime percentage:

Code: Select all

$total_uptime_hrs = ($totaltime-$total_dwntime_hrs);
$uptime_percent = ($total_uptime_hrs*100);
$total_uptime_percent = ($uptime_percent/$totaltime);
When I output it, its a really long decimal. How can I round it to... lets say, 2 decimal places?

Thanks,
- Jeff

Posted: Fri Jul 28, 2006 12:05 pm
by Luke

Code: Select all

round()
LOL RTFM :lol:

Posted: Fri Jul 28, 2006 12:07 pm
by ibanez270dx
hahaha! Well, I gotta start someplace...

Posted: Fri Jul 28, 2006 12:09 pm
by Luke
No problem it was just sorta funny...