<?php function human_filesize($size,$unit="") { if( (!$unit && $size >= 1<<30) || $unit == "GB") return number_format($size/(1<<30),2)."GB"; if( (!$unit && $size >= 1<<20) || $unit == "MB") return number_format($size/(1<<20),2)."MB"; if( (!$unit && $size >= 1<<10) || $unit == "KB") return number_format($size/(1<<10),2)."KB"; return number_format($size)." bytes"; } $start = microtime(true); for($i=0;$i<10000;$i++) human_filesize(123456789); echo microtime(true) - $start . PHP_EOL;
You have javascript disabled. You will not be able to edit any code.