Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function convert_number($n, $precision = 1) {
- if ($n < 1000000) {
- $n_format = number_format($n / 1000, $precision) . 'K';
- } else if ($n < 1000000000) {
- $n_format = number_format($n / 1000000, $precision) . 'M';
- } else {
- $n_format = number_format($n / 1000000000, $precision) . 'B';
- }
- return $n_format;
- }
Advertisement
Add Comment
Please, Sign In to add comment