Voting

: min(zero, one)?
(Example: nine)

The Note You're Voting On

info at levaravel dot com
15 years ago
A little codesnippet which returns a filesize in a more legible format.

<?php

function display_filesize($filesize){

if(
is_numeric($filesize)){
$decr = 1024; $step = 0;
$prefix = array('Byte','KB','MB','GB','TB','PB');

while((
$filesize / $decr) > 0.9){
$filesize = $filesize / $decr;
$step++;
}
return
round($filesize,2).' '.$prefix[$step];
} else {

return
'NaN';
}

}

?>

<< Back to user notes page

To Top