<?php
	function unitize($bin, $units, $lastUnit=0) {
		if (($bin / 1024) > 1) {
			$lastUnit++;
			unitize($bin / 1024, $units, $lastUnit);
		} else {
			echo round($bin, 2) . ' ' . $units[$lastUnit];
		}
	}
	
	function getFileSize($bin) {
		$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');		
		unitize($bin, $units);
	}
	
	getFileSize(1000000000000000000000000/* quadriljoen bytes */);
?>