All pastes #611690 Raw Edit

Anonymous

public php v1 · immutable
·published 2007-07-10 00:57 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) );        printf("%.2f%s\n", $size, $sizeNames[$whichName]);}