471,337 Members | 1,091 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

formatting number

Hi

Can sombody tell me the best way to format a number in this way.

456.45657 must be 456,46

So the point becoms a comma and I would have 2 digits i.pv. 5

thanks,

Alain
Jul 17 '05 #1
3 1475
I noticed that Message-ID: <c5**********@news.worldonline.be> from Alain
Dhaene contained the following:
Can sombody tell me the best way to format a number in this way.

456.45657 must be 456,46

So the point becoms a comma and I would have 2 digits i.pv. 5


http://uk.php.net/number_format

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
On Sat, 10 Apr 2004 09:14:16 +0200, Alain Dhaene wrote:
Can sombody tell me the best way to format a number in this way.

456.45657 must be 456,46

So the point becoms a comma and I would have 2 digits i.pv. 5


Take care of precision:
http://www.php.net/manual/en/function.round.php

Fix the output format:
http://www.php.net/manual/en/function.number-format.php

--
mvh/regards
Joachim Mæland

If everything seems under control, you're just not going fast enough.
-Mario Andretti

Jul 17 '05 #3
"Geoff Berrow" <bl******@ckdog.co.uk> wrote in message
news:9n********************************@4ax.com...
I noticed that Message-ID: <c5**********@news.worldonline.be> from Alain
Dhaene contained the following:
Can sombody tell me the best way to format a number in this way.

456.45657 must be 456,46

So the point becoms a comma and I would have 2 digits i.pv. 5


http://uk.php.net/number_format


There's also setlocale(), although using it is somewhat dicey.
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Thomas Philips | last post: by
4 posts views Thread by John Sutor | last post: by
7 posts views Thread by ilona | last post: by
2 posts views Thread by jodyblau | last post: by
7 posts views Thread by L. Scott M. | last post: by
14 posts views Thread by Scott M. | last post: by
6 posts views Thread by Jack | last post: by
5 posts views Thread by Berryl Hesh | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.