Skip to content

Instantly share code, notes, and snippets.

@pixeloution
Last active August 29, 2015 14:05
Show Gist options
  • Save pixeloution/58bb2e4325650a97ef50 to your computer and use it in GitHub Desktop.
Save pixeloution/58bb2e4325650a97ef50 to your computer and use it in GitHub Desktop.
Max Memory Usage, PHP
<?php
$unit = ['b','kb','mb','gb','tb','pb'];
$size = memory_get_peak_usage(true);
$usage = @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
echo $usage . PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment