Non-looping nice file size

No loop, does laundry.

function lanudry ($bytes) {
    $symbols = array("B", "KB", "MB", "GB", "TB");
    $exp = floor( log($bytes) / log(1000) );
    return sprintf('%.2f '.$symbol[$exp], ($bytes/pow(1000, floor($exp))));
}

Usage

When finished, laundry is outputted to stdout.


Comments

Add your comment