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
Post a Comment