Hi all
I'm comparing $total and $previoustotal, which are figures that end in two decimal places. I want to display the result with no decimal places.
$result = $total-$previoustotal;
print ("number_format($result,0)");
This works fine but if the compared numbers are the same, for example 1234.37 and 1234.37 - the result is sometimes minus zero, and sometimes zero.
I wondered if the rounding up might cause this but it doesn't seem to matter if the digits after the decimal point are over .50 or not.
I could do something like:
if (number_format($result,0) == -0) $result = 0;
... but I'm sure there's a more elegant way and I'm not sure -0 would be recognised anyway.
Any tips?
cheers