rocknbil - 3:46 pm on Mar 14, 2012 (gmt 0)
numbers generated off the site are always off by a few cents
You're probably seeing the effects of floating point precision, which not only affects PHP, it affects just about every programming language and is machine specific. Every processor has a floating point precision placeholder*
and has different decimal places for different for different machines. That placeholder throws off the decimal calculations. It used to drive me nuts. I usually do
sprintf("%.2f",intval($raw_num * 100)/100));
*The precise terms and lanaguage is probably inaccurate, but that's the gist.