Advertisements

wp_convert_bytes_to_hr

Definition:
function wp_convert_bytes_to_hr( $bytes ) {}

Parameters

  • unknown_type $bytes

Source code

function wp_convert_bytes_to_hr( $bytes ) {

	$units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' );

	$log = log( $bytes, 1024 );

	$power = (int) $log;

	$size = pow(1024, $log - $power);

	return $size . $units[$power];

}

3489

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: