
05-26-2017, 04:30 AM
|
 |
|
|
Join Date: May 2006
Location: Los Angeles, CA (US)
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by MarkFL
You could use the following:
PHP Code:
function fHcountHits($num)
{
if ($num)
{
$num = str_replace(',', '', $num);
$prefix = array(0 => '', 1 => 'K', 2 => 'M', 3 => 'G', 4 => 'T');
$pk = floor((1/3)*log($num, 10));
$num = round(($num/pow(10, 3*$pk)), 1) . $prefix[$pk];
}
return $num;
}
|
Thanks for the optimization of the code. It works.
|