On Wed, 2006-09-06 at 11:21 -0500, Jay Blanchard wrote:
> [snip]
> I am trying to format a double to use thousands seperators and such.
> number_format does not appear to be working properly for this.
> My guess is cause I am trying to format a double rather than a string.
> Is there anything out there that will allow me to format a double to
> include
> a comma as a thousands seperator.
> Thanks.
> [/snip]
>
> http://www.php.net/printf
Printf() doesn't do thousands separation as the OP is requiring (unless
they've added that feature since I last read the manual -- and yes I'm
too lazy to go look right now ;)
>From the number_format doc though...
string number_format ( float number [, int decimals [, string
dec_point, string thousands_sep]] )
And if I'm not mistaken, PHP doesn't distinguish between floats and
doubles and treats them all as doubles. Number_format() should work fine
as follows:
<?php
$foo = 1000001.2342
echo number_format( $foo );
?>
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php