|
Posted by ED on 09/13/06 13:11
"Koncept" <user@unknown.invalid> wrote in message
news:110920062049520846%user@unknown.invalid...
> In article <ee49ue0d0o@drn.newsguy.com>, Tim <tim@aol.net> wrote:
>
>> You could use printf|sprintf and assign it to whatever variable you
>> needed it
>> for. As an example, maybe...
>>
>> $rounded_no = sprintf("%.2f", $fp_no);
>
> Yep. sprintf is what you are looking for. It returns a formatted value
> but does not print like printf. Tim's example will work just fine for
> you.
>
> --
> Koncept <<
> "The snake that cannot shed its skin perishes. So do the spirits who are
> prevented from changing their opinions; they cease to be a
> pirit." -Nietzsche
Or for yet another alternative use number_format:
$rounded = number_format($number, 2, '.', '');
Navigation:
[Reply to this message]
|