All pastes #560857 Raw Edit

Mine

public php v1 · immutable
·published 2007-06-12 07:04 UTC
rendered paste body
function formatFileSize($bytes){	$kiloBytes = ($bytes / 1024);		if($kiloBytes > 1023)	{		$megaBytes = $kiloBytes / 1024;				if($megaBytes > 1023)		{			$gigaBytes = $megaBytes / 1024;						if($gigaBytes > 1023) // Lets hope not!			{				$teraBytes = $gigaBytes / 1024;								return round($teraBytes, 2)." TB";			}			else 				return round($gigaBytes, 2)." GB";		}		else 			return round($megaBytes, 2)." MB";	}	else 		return round($kiloBytes, 2)." KB";}