according to the pdf version of the manual I have, round() is what you need

float round(float val[, int precision])

have another look that the man page

-----Original Message-----
From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 24, 2002 1:35 PM
To: [EMAIL PROTECTED]
Subject: [PHP] rounding a number


I want to round a number to the nearest decimal place...

if the number is 4.623, I want it to display 4.6 
if the number is 2.36, I want it to display 2.7

Is there a function that does this?  round(), ceil(), floor() don't do
this and I've checked through all the math functions in my handy-dandy
"PHP Functions" reference book.

Thanks for your help!!!

Or......if it's too hard to do that, I could just use a function that
chops off the end of some decimals, like...

if the number is 2.343234, I want just 2.3
or if the number is 2.545434534534534534, I want just 2.5

Thanks!!!!!!

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

Reply via email to