Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- initial import

  • Loading branch information...
commit 12b4f9ddfec8aae848862fb879fb240b87286a88 1 parent 2f0c5a3
@pierrejoye pierrejoye authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 include/tools.php
View
9 include/tools.php
@@ -0,0 +1,9 @@
+<?php
+function bytes2string($size, $precision = 2) {
+ $sizes = array('YB', 'ZB', 'EB', 'PB', 'TB', 'GB', 'MB', 'kB', 'B');
+ $total = count($sizes);
+
+ while($total-- && $size > 1024) $size /= 1024;
+
+ return round($size, $precision).$sizes[$total];
+}
Please sign in to comment.
Something went wrong with that request. Please try again.