RE: [PHP] Peculiar number_format() behaviour

2004-03-22 Thread Ford, Mike [LSS]
On 22 March 2004 10:31, Paul Hopkins wrote: > Here's the code: > > $a = 676.6; > $b = 0.175; > > $y = $a * (1 + $b); > echo("y: " . $a . " * (1 + " . $b . ") = $y"); > > $z = $a + ($a * $b); > echo("z: " . $a . " + ( " . $a . " * " . $b . ") = $z"); > > echo("number format(y)=".number_format(

[PHP] Peculiar number_format() behaviour

2004-03-22 Thread Paul Hopkins
Here's the code: "); $z = $a + ($a * $b); echo("z: " . $a . " + ( " . $a . " * " . $b . ") = $z"); echo("number format(y)=".number_format($y, 2).""); echo("number format(z)=".number_format($z, 2).""); ?> Here's the output: y: 676.6 * (1 + 0.175) = 795.005 z: 676.6 + ( 676.6 * 0.175) = 795.005