You are here

function _formatBytes in Simple LDAP 7.2

2 calls to _formatBytes()
simple_ldap_user_drush_scan_all in simple_ldap_user/simple_ldap_user.drush.inc
_simple_ldap_user_check_existing_by_mail in simple_ldap_user/simple_ldap_user.drush.inc

File

simple_ldap_user/simple_ldap_user.drush.inc, line 3

Code

function _formatBytes($size, $precision = 2) {
  $base = log($size) / log(1024);
  $suffixes = array(
    '',
    'k',
    'M',
    'G',
    'T',
  );
  return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
}