code: public static function parse($size, $fallbackUnits = null)
      {
          preg_match('/^(\d+)[.,]?(\d*)\s*(\w*)$/', $size, $matches);
          if (empty($matches[1]) || (empty($matches[3]) && null === $fallbackUnits)) {
              throw new \UnexpectedValueException("Unable to parse : '{$size}'");
          }
          $oSize = $matches[1];
          if (!empty($matches[2])) {
              $oSize .= '.'.$matches[2];
          }
          $oSize = (float) $oSize;
          $unit = strtolower(empty($matches[3]) ? $fallbackUnits : $matches[3]);
          $byteMultiplier = 1;
          if ('b' === substr($unit, -1)) {
              $byteMultiplier = 8;
              $unit = substr($unit, 0, -1).'o';
          }
          if (!array_key_exists($unit, self::getBinarySizes())) {
              throw new \UnexpectedValueException("Unexpected unit {$unit}");
          }
  
          return (int) ($oSize * self::getBinarySizes()[$unit] * $byteMultiplier);
      }
docs: Takes a human-formatted binary size and return a number of octets
  
  @param string $size
  @param string $fallbackUnits
  
  @throws \UnexpectedValueException
  
  @return int