All pastes #611653 Raw Edit

Anonymous

public php v1 · immutable
·published 2007-07-10 00:47 UTC
rendered paste body
function humanSize( $size ){        $sizeNames = array( 'b', 'kb', 'mb', 'gb' );        $whichName = 0;        while( $size > 1024 && $whichName < count($sizeNames) - 1 )        {                $size = $size / 1024;                $whichName++;        }        printf("%.2f%s\n", $size, $sizeNames[$whichName]);}