Microweber\Utils\Files::file_size_nice PHP Method

file_size_nice() public method

Returns a human readable filesize.
Author: wesman20 (php.net)
Author: Jonas John
public file_size_nice ( $size )
    public function file_size_nice($size)
    {
        // Adapted from: http://www.php.net/manual/en/function.filesize.php
        $mod = 1024;
        $units = explode(' ', 'B KB MB GB TB PB');
        for ($i = 0; $size > $mod; ++$i) {
            $size /= $mod;
        }
        return round($size, 2) . ' ' . $units[$i];
    }