mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 03:08:11 +00:00
Merge pull request #286 from niekvanderkooy/develop
Generalise Steam::phpBytes
This commit is contained in:
@@ -206,16 +206,23 @@ class Steam
|
|||||||
{
|
{
|
||||||
$string = strtolower($string);
|
$string = strtolower($string);
|
||||||
|
|
||||||
if (!(strpos($string, 'k') === false)) {
|
if (!(stripos($string, 'k') === false)) {
|
||||||
// has a K in it, remove the K and multiply by 1024.
|
// has a K in it, remove the K and multiply by 1024.
|
||||||
$bytes = bcmul(rtrim($string, 'k'), '1024');
|
$bytes = bcmul(rtrim($string, 'kK'), '1024');
|
||||||
|
|
||||||
return intval($bytes);
|
return intval($bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(strpos($string, 'm') === false)) {
|
if (!(stripos($string, 'm') === false)) {
|
||||||
// has a M in it, remove the M and multiply by 1048576.
|
// has a M in it, remove the M and multiply by 1048576.
|
||||||
$bytes = bcmul(rtrim($string, 'm'), '1048576');
|
$bytes = bcmul(rtrim($string, 'mM'), '1048576');
|
||||||
|
|
||||||
|
return intval($bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(stripos($string, 'g') === false)) {
|
||||||
|
// has a G in it, remove the G and multiply by (1024)^3.
|
||||||
|
$bytes = bcmul(rtrim($string, 'gG'), '1073741824');
|
||||||
|
|
||||||
return intval($bytes);
|
return intval($bytes);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user