[code]
// 1 million coins ">

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, '.', ':');