But what I need is, let's say that I have 2,500,000 income/gold, or whatever. Instead of it showing that amount the way it is, how would I write it so that it would show it as 2500K? Any Ideas? Thanks!!!
The closest I've gotten is something like this:
Code: Select all
<?php
function my_number_format($n) {
$n = (0+str_replace(",","",$n));
if(!is_numeric($n)) return false;
if($n>1000000000000) return round(($n/1000000000000),1).' T';
else if($n>1000000000) return round(($n/1000000000),1).' B';
else if($n>1000000) return round(($n/1000000),1).' M';
else if($n>1000) return round(($n/1000),1).' K';
return number_format($n);
}
echo my_number_format($stats['gold']);
?>