src/Helpers/FormatHelper.php
public static function convertBytes($value)
    {
        if (is_numeric($value)) {
            return $value;
        }

        $value_length = \strlen($value);
        $qty = (int)substr($value, 0, $value_length - 1);
        $unit = Str::strtolower(substr($value, $value_length - 1));
        switch ($unit) {
            case 'k':
                $qty *= 1024;
                break;
            case 'm':
                $qty *= 1048576;
                break;
            case 'g':
                $qty *= 1073741824;
                break;
        }

        return $qty;
    }
public static function convertBytes($value)
    {
        if (is_numeric($value)) {
            return $value;
        }

        $value_length = \strlen($value);
        $qty = (int)substr($value, 0, $value_length - 1);
        $unit = Str::strtolower(substr($value, $value_length - 1));
        switch ($unit) {
            case 'k':
                $qty *= 1024;
                break;
            case 'm':
                $qty *= 1048576;
                break;
            case 'g':
                $qty *= 1073741824;
                break;
        }

        return $qty;
    }
public static function convertBytes ( $ value ) { if ( is_numeric ( $ value ) ) { return $ value ; } $ value_length = \ strlen ( $ value ) ; $ qty = ( int ) substr ( $ value , 0 , $ value_length - 1 ) ; $ unit = Str :: strtolower ( substr ( $ value , $ value_length - 1 ) ) ; switch ( $ unit ) { case 'k' : $ qty *= 1024 ; break ; case 'm' : $ qty *= 1048576 ; break ; case 'g' : $ qty *= 1073741824 ; break ; } return $ qty ; }
Convert a shorthand byte value from a PHP configuration directive to an integer value
@param string $value value to convert
@return int
Convert a shorthand byte value from a PHP configuration directive to an integer value