byte conversion
Posted: Tue Mar 25, 2003 4:26 pm
Is there a function that i missed when i looked or doesn someone know a function that would accept a number (bytes) and convert it to the biggest unit that would be above 0?
For example :
Would that be right?
For example :
Code: Select all
function convertByte( $bytes ) {
$sizes = array( " Bytes", " KB", " MB", " GB" );
$size = 0;
while ( $bytes >= 1024 ) {
$bytes /= 1024;
$size++;
}
return number_format($bytes) . $sizesї$size];
}