Skip to content

Instantly share code, notes, and snippets.

@fvosberg
Created December 29, 2015 14:42
Show Gist options
  • Save fvosberg/ba65481c2abedfa75ada to your computer and use it in GitHub Desktop.
Save fvosberg/ba65481c2abedfa75ada to your computer and use it in GitHub Desktop.
Display memory usage
$size = memory_get_usage(TRUE);
$unit = array('b','kb','mb','gb','tb','pb');
$mem = @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment