RE: Amy's Site question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hello,
> 
> On a site I'm listing measurements in both inches and cm; in the db 
> they're stored as inches. To convert them to cm I'm doing:
> 
> <?php echo ($cartoon['art_width'] * 2.54); ?> x <?php echo 
> ($cartoon['art_height'] * 2.54); ?> cm
> 
> 
> How can I limit the result of that math to one decimal place, ie, 9.5 
> cm, not 9.523 cm?
> 


Use 'number_format()':

string number_format ( float number [, int decimals [, string dec_point [,
string thousands_sep]]])


JM

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux