diff options
author | Derek Jones <derek.jones@ellislab.com> | 2008-06-30 02:22:42 +0200 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2008-06-30 02:22:42 +0200 |
commit | e37fa05e9687ff461b1ff7413633ea697365c128 (patch) | |
tree | 78e40ff9e9b971fb2d66775c5d30113162e0179c | |
parent | c5d9319bc3216e305874a85da9d0acfe6c2ba5d1 (diff) |
fixed some whitespace in the number helper and improved on the calculation method
-rw-r--r-- | system/helpers/number_helper.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index 8c9e384eb..80a7a6036 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -40,26 +40,26 @@ if ( ! function_exists('byte_format')) {
$CI =& get_instance();
$CI->lang->load('number');
-
+
if ($num >= 1000000000000)
{
- $num = round($num/1099511627776)/10;
- $unit = $CI->lang->line('terabyte_abbr');
+ $num = round($num / 1099511627776, 1);
+ $unit = $CI->lang->line('terabyte_abbr');
}
elseif ($num >= 1000000000)
{
- $num = round($num/107374182)/10;
- $unit = $CI->lang->line('gigabyte_abbr');
+ $num = round($num / 1073741824, 1);
+ $unit = $CI->lang->line('gigabyte_abbr');
}
elseif ($num >= 1000000)
{
- $num = round($num/104857)/10;
- $unit = $CI->lang->line('megabyte_abbr');
+ $num = round($num / 1048576, 1);
+ $unit = $CI->lang->line('megabyte_abbr');
}
elseif ($num >= 1000)
{
- $num = round($num/102)/10;
- $unit = $CI->lang->line('kilobyte_abbr');
+ $num = round($num / 1024, 1);
+ $unit = $CI->lang->line('kilobyte_abbr');
}
else
{
|