Re: decimal formatting
- From: Kim André Akerø <kimandre@xxxxxxxxxxxxxxxxxx>
- Date: 11 Sep 2006 11:20:57 GMT
wesley@xxxxxxxxxxxx wrote:
Hi all
I have a floating point number stored in a variable. i want to round
that number off to two places and store it in a variable. Does anyone
know how to do that?
I know that i can use the printf to display the number to 2 decimal
places. but i want to store that number in a vaiable.
How about this:
$value = 3.1415926535897932384626433832795;
$value = round($value, 2);
http://no.php.net/round
--
Kim André Akerø
- kimandre@xxxxxxxxxxxxxxxxxx
(remove NOSPAM to contact me directly)
.
- Follow-Ups:
- Re: decimal formatting
- From: aaron . reese
- Re: decimal formatting
- References:
- decimal formatting
- From: wesley
- decimal formatting
- Prev by Date: decimal formatting
- Next by Date: Data from an array of objects (also in Dutch)
- Previous by thread: decimal formatting
- Next by thread: Re: decimal formatting
- Index(es):
Relevant Pages
|