|
Posted by Jerry Stuckle on 05/14/06 23:00
WJ Zeeuwen wrote:
> Hi all,
>
> Is it possible to adjust the number of digits in a float?
>
> For example $test = 1/3; echo ($test); gives 0.33333333.. But i only
> want 0.33
> Is there a function or do i have to use round($test*100)/100
>
> Thanx,
> WJ
If all you want to do is display the value 0.33 without actually changing the
number (which will affect future math operations), you can use
printf("%01.2f", 0.33);
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|