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

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

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

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

        return round($size);
    }
public static function filesizeToBytes ( $ size ) { $ unit = preg_replace ( '/[^bkmgtpezy]/i' , '' , $ size ) ; $ size = preg_replace ( '/[^0-9\.]/' , '' , $ size ) ; if ( $ unit ) { return round ( $ size * pow ( 1024 , stripos ( 'bkmgtpezy' , $ unit [ 0 ] ) ) ) ; } return round ( $ size ) ; }
Convert a size string, such as 5M to bytes.

@param string $size

@return float
Convert a size string such as 5M to bytes .