function formatMemory($memory) {
		switch (true) {
			case $memory == 0:
				return 0;
			
			case $memory < 1024:
				$memory = round($memory) . 'b';
				break;
			
			case $memory < 1048576:
				$memory = round($memory / 1024, 2) . 'K';
				break;
			
			case $memory < 10485760:
				$memory = round($memory / 1024, 1) . 'K';
				break;
			
			case $memory < 104857600:
				$memory = round($memory / 1024) . 'K';
				break;
			
			case $memory < 1073741824:
				$memory = round($memory / 1048576, 1) . 'M';
				break;
			
			default:
				$memory = round($memory / 1048576) . 'M';
		}
		
		return $memory;
	}