PHP – Human size format

27 Nov, 2008   Adăugat de in php, programare | 
Taguri : , ,
1
2
3
4
5
6
7
8
9
< ?php
function human_size($size) {
$units = array('B','KB','MB','GB');
for ($i = 0; $size > 1024; $i++) {
$size /= 1024;
}
return round($size, 2).' '.$units[$i];
}
?>

No Responses so far | Have Your Say!

Leave a Feedback

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

 

63 queries. 0.593 seconds.