/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function bytesToText($bytes, $precision = 2, $units = null) { if ($units) { $i = $power; while ($i-- > 0) { $bytes /= 1024; } } else { $bytes = (float) $bytes; $power = 0; while ($bytes >= 1000) { $bytes /= 1024; $power++; } } if ($power == 0) { $precision = 0; } }
URL: bytes-to-text