Skip to content

Instantly share code, notes, and snippets.

@digjack
digjack / memory_usage.php
Created June 7, 2018 05:39 — forked from mehdichaouch/memory_usage.php
PHP Snippet to get human readable memory usage
<?php
function convert($size)
{
$unit=array('b','kb','mb','gb','tb','pb');
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
}
convert(memory_get_usage());