First time poster - hope this is the right place!
Here's the code:
<?php
$a = 676.6;
$b = 0.175;
$y = $a (1 + $b);
echo("y: " . $a . " (1 + " . $b . ") = $y<BR>");
$z = $a + ($a $b);
echo("z: " . $a . " + ( " . $a . " " . $b . ") = $z<BR>");
echo("number format(y)=".number_format($y, 2)."<BR>");
echo("number format(z)=".number_format($z, 2)."<BR>");
?>
Here's the output:
y: 676.6 (1 + 0.175) = 795.005
z: 676.6 + ( 676.6 0.175) = 795.005
number format(y)=795.01
number format(z)=795.00
In other words, using two logically equivalent (?) formulae to derive exactly the same result from the same two values results in somehow different results (I guess it's not an issue with number_format() per se, but with associativity or summat...).
Hope it's not an obvious schoolboy error - any ideas?
PHP 4.2.2
Apache 2.0.40
Redhat 7.3