|
Posted by David Grant on 11/16/05 22:37
Hi Scott,
How do you distinguish between a value filled with zeroes and a value
with 0 in both decimal positions?
For example, why is 3145900 expressed as 3,145.90, and not 31,459.00?
Cheers,
David Grant
Scott Parks wrote:
> Hi-
>
> I have a number that I am trying to format. It is data coming from a
> main frame and
> has 8 characters assigned to it (6 and two decimal places). I have
> zerofill set up in
> MySQL on this field and am working on the best way to display the number.
>
> Currently I have this:
>
> $sOutput = number_format(rtrim($sValue,'0') /100,2);
>
> What I am running into is this, I have a number in this field as:
> 3145900, using the above I will get: 314.59, which is wrong, it
> needs to be 3,145.90.
>
> Yet, if I have a number of: 749450, I get the result I am looking for
> of 749.45.
>
> I did not see a way to tell trim I only want one 0 cut?
>
> Any thoughts?
>
> Thank you!
>
> -Scott
>
> --PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Navigation:
[Reply to this message]
|