Oops! Copied the numbers wrong. Here's are the numbers I meant
to type:
R> $onum output
R> 4.166 4.12
4.1166 4.12
R> 4.135 4.11
4.1135 4.11
R> 4.000 4
R> 4.30004.3
R> Is that what you wanted? To me, it's much easier to code and use
R> than reg expressions an
Hello Ethan,
$onum=4.11440;
$onum =number_format($onum,2)+0;
echo $onum;
With this technique, you get the following:
$onum output
4.166 4.12
4.135 4.11
4.000 4
4.30004.3
Is that what you wanted? To me, it's much easier to code and use
than reg expressions and replaces.
Bes
I need to format decimals that are percise to the second place in the
following format:
4.00 to 4
4.50 to 4.5
4.25 to 4.25
As you can see, I just want to drop the trailing zeros, and if necessary the
decimal.
Thanks
___
Ethan Nelson, Systems Administrator
Net So
3 matches
Mail list logo