public static function parseSize($size)
    {
        $unit = preg_replace('/[^bkmgtpezy]/i', '', $size);
        $size = preg_replace('/[^0-9\.]/', '', $size);

        if ($unit) {
            $size = $size * pow(1024, stripos('bkmgtpezy', $unit[0]));
        }

        return (int) abs(round($size));
    }
public static function parseSize($size)
    {
        $unit = preg_replace('/[^bkmgtpezy]/i', '', $size);
        $size = preg_replace('/[^0-9\.]/', '', $size);

        if ($unit) {
            $size = $size * pow(1024, stripos('bkmgtpezy', $unit[0]));
        }

        return (int) abs(round($size));
    }
public static function parseSize ( $ size ) { $ unit = preg_replace ( '/[^bkmgtpezy]/i' , '' , $ size ) ; $ size = preg_replace ( '/[^0-9\.]/' , '' , $ size ) ; if ( $ unit ) { $ size = $ size * pow ( 1024 , stripos ( 'bkmgtpezy' , $ unit [ 0 ] ) ) ; } return ( int ) abs ( round ( $ size ) ) ; }
Parse a readable file size and return a value in bytes

@param string|int $size
@return int
Parse a readable file size and return a value in bytes