PHP - Show String as Currency - Comma Separated - number_format()

7 February 2012, 12:57 PM

Working to show currency in a readable format


// 1 million coins is easier to read as 1,000,000
$value = "1000000";

// echo as 1,000,000
echo number_format($value, 0, '.', ',');

// echo as 1,000,000.00
echo number_format($value, 2, '.', ',');

// echo as 1:000:000
echo number_format($value, 0, '.', ':');

 


Categories

All
General
Applications
Code
Networking
 

 

 

Recent blog posts

4

Cent OS adding port into iptables - command line SSH
4 August 2013, 10:06 AM - Read More
   

17

Convert NSTimeInterval to NSString - iOS Development
17 September 2012, 4:38 PM - Read More
   

12

Find string in NSArray and return index of string - iOS Development
12 September 2012, 3:54 PM - Read More
   

Recent apps

Slots!
Read More
   
MobileRota
Read More
   
Eleven2
Read More
   

 

Customer Support

Need help with a product?
Product Support


Contact

Drop us a line?
hello@olliekett.com
   
Follow us on Twitter
@okdltd