Update src/Util/Strings.php
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
This commit is contained in:
parent
ce56cabd9f
commit
765b50bde8
|
@ -525,16 +525,16 @@ class Strings
|
||||||
*/
|
*/
|
||||||
public static function getBytesFromShorthand(string $shorthand): int
|
public static function getBytesFromShorthand(string $shorthand): int
|
||||||
{
|
{
|
||||||
$shorthand = trim($shorthand);
|
$shorthand = trim($shorthand);
|
||||||
|
|
||||||
if (is_numeric($shorthand))
|
if (is_numeric($shorthand)) {
|
||||||
return $shorthand;
|
return $shorthand;
|
||||||
|
}
|
||||||
|
|
||||||
$last = strtolower($shorthand[strlen($shorthand)-1]);
|
$last = strtolower($shorthand[strlen($shorthand)-1]);
|
||||||
$shorthand = substr($shorthand, 0, -1); // necessary since PHP 7.1; otherwise optional
|
$shorthand = substr($shorthand, 0, -1);
|
||||||
|
|
||||||
switch($last) {
|
switch($last) {
|
||||||
// The 'G' modifier is available since PHP 5.1.0
|
|
||||||
case 'g':
|
case 'g':
|
||||||
$shorthand *= 1024;
|
$shorthand *= 1024;
|
||||||
case 'm':
|
case 'm':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user