RE: [PHP3] formatting a double From: Mike Sheldon (msheldon <email protected>)
Date: 04/30/00

Use the number_format() function

number_format(float $number[, int $decimal_places[, string
$decimal_separator, string $thousands_separator]])

So:

number_format(3,666666667, 2, ",", ".")

Would result in:

3,66

Michael J. Sheldon
Internet Applications Developer
Phone: 480.699.1084
http://www.desertraven.com/
PGP Key Available on Request

-----Original Message-----
From: Gurkan Nisanci [mailto:nisanci <email protected>]
Sent: Sunday, April 30, 2000 12:15
To: php3 <email protected>
Subject: [PHP3] formatting a double

I have a variable num1 and its value is 3,666666667.
But I want to print it as 3,66 not 3,666666667.
So how must I write the echo statement to format the double number?

--
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to:
http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>

-- PHP 3 Mailing List <http://www.php.net/> To unsubscribe, send an empty message to php3-unsubscribe <email protected> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-admin <email protected>