floating point precision - php sum zero value to float number -


i'm in trouble this:

$price = 26,20; $increase = 0,00; $decrease = 0,00;  $result = ($price + $increase - $decrease);   

result becomes 26 instead of 26,20

any idea?

thnx!

you can use number_format in case need comma decimal separator, see example below:

$price = 26.20; $increase = 0.00; $decrease = 0.00;  $result = ($price + $increase - $decrease); echo number_format($result , 2, ',', ''); 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -