Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function friendlyBytes($size,$pre = 2) {
- $sizes = array('B','KB','MB','GB','TB','PB','EB','ZB','YB');
- for ($i = (count($sizes)); $i > 0; $i--) {
- if ($i > 0) {
- $exp = pow(1024,$i);
- if ($size > $exp) {
- return round(($size / $exp),$pre).$sizes[$i];
- }
- }
- }
- return $size."B";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement