function formatBytes($bytes, $precision = 2)
{
if ($bytes == 0) return '0 B';
$sizes = array('B', 'KB', 'M', 'GB', 'TB');
$base = log($bytes, 1024);
return round(pow(1024, $base - floor($base)), $precision) . ' ' . $sizes[floor($base)];
}
$c = disk_total_space("c:");
$d = disk_total_space("d:");
echo "disk c total space = ".formatBytes($c)."<br />";
echo "disk c total space = ".formatBytes($d)."<br />";
/*
run:
disk c total space = 118.7 GB
disk c total space = 931.51 GB
*/