diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Helper/TextHelper.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/Helper/TextHelper.php b/app/Helper/TextHelper.php index 89c1a8f3..698bef6d 100644 --- a/app/Helper/TextHelper.php +++ b/app/Helper/TextHelper.php @@ -90,19 +90,19 @@ class TextHelper extends Base */ public function phpToBytes($val) { - $val = trim($val); - $last = strtolower($val[strlen($val)-1]); + $size = (int) substr($val, 0, -1); + $last = strtolower(substr($val, -1)); switch ($last) { case 'g': - $val *= 1024; + $size *= 1024; case 'm': - $val *= 1024; + $size *= 1024; case 'k': - $val *= 1024; + $size *= 1024; } - return $val; + return $size; } /** |