Skip to content

Instantly share code, notes, and snippets.

@DrMabuse23
Created June 4, 2013 17:06
Show Gist options
  • Save DrMabuse23/5707685 to your computer and use it in GitHub Desktop.
Save DrMabuse23/5707685 to your computer and use it in GitHub Desktop.
/**
* @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