new function to convert human readable mememory to bytes
This commit is contained in:
parent
20b672cd09
commit
8d06d47318
|
@ -297,4 +297,10 @@ class Text {
|
|||
return $truncate;
|
||||
}
|
||||
|
||||
public static function toBytes($value) {
|
||||
$value = trim($value);
|
||||
$s = [ 'g'=> 1<<30, 'm' => 1<<20, 'k' => 1<<10 ];
|
||||
return intval($value) * ($s[strtolower(substr($value,-1))] ?: 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue