Skip to content

Commit 9c20044

Browse files
committed
[machine_size] replaces switch-case with if statement.
1 parent 53dcc75 commit 9c20044

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cache.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ function machine_size( $val ) {
103103
$val = (int) substr($val, 0, -1);
104104
}
105105

106-
switch($last) {
107-
case 'g':
108-
$val *= 1024;
109-
case 'm':
110-
$val *= 1024;
111-
case 'k':
112-
$val *= 1024;
113-
}
106+
if ($last == 'g')
107+
$val *= (1024 * 1024 * 1024);
108+
109+
if ($last == 'm')
110+
$val *= (1024 * 1024);
111+
112+
if ($last == 'k')
113+
$val *= 1024;
114114

115115
return $val;
116116
}

0 commit comments

Comments
 (0)