asSize() public method
Formats the value in bytes as a size in human readable form, for example 12 kilobytes
.
If $sizeFormatBase is 1024, binary prefixes (e.g. kibibyte/KiB, mebibyte/MiB, ...) are used in the formatting result.
See also:
- \yii\i18n\sizeFormat
- asShortSize()
public string asSize ( $value, $decimals = null, $options = [], $textOptions = [] ) | ||
---|---|---|
$value | string|integer|float |
Value in bytes to be formatted. |
$decimals | integer |
The number of digits after the decimal point. |
$options | array |
Optional configuration for the number formatter. This parameter will be merged with $numberFormatterOptions. |
$textOptions | array |
Optional configuration for the number formatter. This parameter will be merged with $numberFormatterTextOptions. |
return | string |
The formatted result. |
throws | yii\base\InvalidParamException |
if the input value is not numeric or the formatting failed. |
Please login to continue.