Jump to content

Calculation and limiting decimals


Jay2391

Recommended Posts

Example:

 

I have a greater total of 61 and I score 45

 

$i= 61;

$y= 45;

 

 

$pct = ($i /$y) * 100;

 

one is tha correct ??? Two how can i limit the number that result diplays (0.987654321 - i just want .987)

 

and how do i turn off this error message???

 

Warning: Division by zero in localhost\info.php on line xxx

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/71900-calculation-and-limiting-decimals/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.