Posted by Justin Koivisto on 10/26/05 16:53
Sander Peters wrote:
> Hi,
>
> I have the following situation:
>
> $a=5.6000;
> $b=8.9000;
> $c=($a+$b);
>
> echo $c;
>
> I will get the value '14.5' back from PHP.
> Wich is logical.
> But what I want is to get the value '14.5000'.
> Is there somehow a workaround to let PHP print 4 decimals?
>
> Thanks in advance for your reaktion.
>
> Sander Peters
> The Netherlands
>
>
printf('%.4f',$c)
--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com
[Back to original message]
|