Jump to content

round of into two decimal places


newphpcoder

Recommended Posts

Hi..I encountered problem in rounding of numbers into two decimal places.here is my sample code:

if($W4_STATUS == 1 AND $DEPENDENTS == 0 AND $TotEarn >= 7917 AND $TotEarn <= 12500) {   $TAX = ($TotEarn - 7917);   $TAX = (937.50 + ($TAX * .25));   $TAX = number_format($TAX, 2, '.', '');}

for example from this:

 $TAX = ($TotEarn - 7917);  $TAX = (937.50 + ($TAX * .25));

the output is: 1417.615using this:

$TAX = number_format($TAX, 2, '.', '');

the output was : 1417.61but it should be : 1417.62Thank you

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...