Created
June 4, 2013 17:06
-
-
Save DrMabuse23/5707685 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @static | |
* @param $n | |
* @return bool|string | |
*/ | |
public static function bdnicenumber($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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment