
Richard Fennah - 2010-10-21 19:39:13
I am currently running the following:
$vatcost = ($amount/100)*$vat;
$totalvat = $totalvat + $vatcost;
$totalvat = number_format($totalvat, 2, '.', '');
At the start of this code $vatcost is 47.915.
Using basic maths this should round to 47.92, however every time this code is run I am getting 47.93!
Does anything seem odd with my code or is this a bug within number_format?
Thanks.