Asf_Util::bytes2string

This is a byte conversion function


Description

public static string Asf_Util::bytes2string(int $size [, bool $space = 1])

Parameters

size

Byte size

space

Do you need spaces?

Return Values

Returns the a string, such as xGB/xMB/xKB/xBytes

Examples

Example #1

<?php
var_dump(Asf_Util::bytes2string(2048.56));
var_dump(Asf_Util::bytes2string(1073741824, 0));
var_dump(Asf_Util::bytes2string(3645.44, 0));
var_dump(Asf_Util::bytes2string(0));

The above example will output:

string(10) "2.00055 KB"
string(3) "1GB"
string(6) "3.56KB"
string(7) "0 Bytes"