Add support for decimal values

This commit is contained in:
SimonFair
2024-04-10 23:44:22 +01:00
parent e9c973baad
commit 62ea5702ce
@@ -49,7 +49,7 @@ function showCPUs($uuid) {
function vsize($size,$expand=true) {
$units = ['','K','M','G','T','P','E','Z','Y'];
if ($expand) {
$size = str_replace(['B',' ',',', '.'],'',strtoupper($size));
$size = str_replace(['B',' ',','],'',strtoupper($size));
[$c1,$c2] = my_preg_split('/(?<=[0-9])(?=[A-Z])/',$size);
return $c1 * pow(1024,array_search($c2,$units)?:0);
} else {