Jump to content

Decimal Help


phpbeginner

Recommended Posts

Hello,

I have a quick question. I am doing a stats program for a hockey team and the question I have is that I have the decimals correct for the goaltenders goals against average and save % as I wish, except for the fact that if its an even # like 2 it will display 2 rather than 2.00. Works fine when the #'s are not even rounding off to 2 and 3 decimals respectively.

Here is the code for the GAA....

$p_array[$playerid][gaa] = ROUND('1.00' * ($p_array[$playerid][goalsa]) * (60/$p_array[$playerid][minutes]), 2);

Any help would be appreciated......thanks in advance !
Link to comment
https://forums.phpfreaks.com/topic/19576-decimal-help/
Share on other sites

thanks, thought there may have been something I could do here in this snippet....

$p_array[$playerid][gaa] = ROUND('1.00' * ($p_array[$playerid][goalsa]) * (60/$p_array[$playerid][minutes]), 2);

like this....

$p_array[$playerid][gaa] = ROUND('1.00' * ($p_array[$playerid][goalsa]) * (60/$p_array[$playerid][minutes]), 2,'.',' ');

Link to comment
https://forums.phpfreaks.com/topic/19576-decimal-help/#findComment-85181
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.