note 57477 deleted from function.number-format by levim
| From: | levim@php.net | Date: | Sun, 23 Mar 2014 14:15:33 +0000 |
| Subject: | note 57477 deleted from function.number-format by levim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-199024@lists.php.net to get a copy of this message | ||
Note Submitter: mikro_at_teppisti_dot_it
----
This function formats numbers 'human readable' better (IMHO) than mircea way:
function humanReadable($val,$thousands=0){
if($val>=1000)
$val=humanReadable($val/1024,++$thousands);
else{
$unit=array('','K','M','T','P','E','Z','Y');
$val=round($val,2).$unit[$thousands].'B';
}
return $val;
}