=0 AND $unit/1024 1024 AND $unit/1024 <= 1024*1024 ) { $unit = 'M'; } else { $unit = 'G'; } } switch(strtolower($unit)) { case 'k': $size = ($size/1024); $suffix = 'KB'; break; case 'm': $size = ($size/1024/1024); $suffix = 'MB'; break; case 'g': $size = ($size/1024/1024/1024); $suffix = 'GB'; break; } $size = sprintf("%.2f%s", $size, $suffix); return $size; } $path = 'min'; var_dump(_dirSize($path, FALSE)); var_dump(_dirSize($path, TRUE)); var_dump(_getDirCount($path)); /*end of php*/