i want my number to appear 1,234,567.89

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
adsegzy
Forum Contributor
Posts: 184
Joined: Tue Jul 28, 2009 9:26 am

i want my number to appear 1,234,567.89

Post by adsegzy »

Hello there,

Please i to display the amount in my database to appear in currency unit. for example if what i have in my database is 123456789, i want to echo it as 1,234,567.89 that is full-stop after the first two figures and comma after every 3 characters

Regards
Olusegun
ipconfig
Forum Newbie
Posts: 2
Joined: Wed Oct 28, 2009 1:15 pm

Re: i want my number to appear 1,234,567.89

Post by ipconfig »

I think this is what you're looking for:

http://php.net/manual/en/function.number-format.php

So, for example:

Code: Select all

$number = 123456789;
echo number_format($number, 2, '.', ',');
Post Reply