src/Number.php
public static function size(float $number, int $decimal = 2, bool $binary = false): string
	{
		if ($number > 1024 * 1024 * 1024) {
			if ($binary) {
				$number = self::getBinary($number / (1024 * 1024)) / 1024;
			} else {
				$number = $number / (1024 * 1024 * 1024);
			}
			return self::getNumber($number, $decimal) . ' GB';
		} elseif ($number > 1024 * 1024) {
			$number /= 1024 * 1024;
			if ($binary) {
				$number = self::getBinary($number);
			}
			return self::getNumber($number, $decimal) . ' MB';
		} elseif ($number > 1024) {
			$number /= 1024;
			if ($binary) {
				$number = self::getBinary($number);
			}
			return self::getNumber($number, $decimal) . ' KB';
		} else {
			if ($binary) {
				$number = self::getBinary($number);
			}
			return self::getNumber($number, $decimal) . ' B';
		}
	}
public static function size(float $number, int $decimal = 2, bool $binary = false): string
	{
		if ($number > 1024 * 1024 * 1024) {
			if ($binary) {
				$number = self::getBinary($number / (1024 * 1024)) / 1024;
			} else {
				$number = $number / (1024 * 1024 * 1024);
			}
			return self::getNumber($number, $decimal) . ' GB';
		} elseif ($number > 1024 * 1024) {
			$number /= 1024 * 1024;
			if ($binary) {
				$number = self::getBinary($number);
			}
			return self::getNumber($number, $decimal) . ' MB';
		} elseif ($number > 1024) {
			$number /= 1024;
			if ($binary) {
				$number = self::getBinary($number);
			}
			return self::getNumber($number, $decimal) . ' KB';
		} else {
			if ($binary) {
				$number = self::getBinary($number);
			}
			return self::getNumber($number, $decimal) . ' B';
		}
	}
Velikost souboru
@param float $number
@param int $decimal
@param bool $binary
@return string