Is there a way to subtract the output value from the total capacity of the disk to calculate free space in PHP?

To calculate the free space on a disk in PHP, you can use the disk_total_space() function to get the total capacity of the disk and the disk_free_space() function to get the available space on the disk. You can then subtract the output value of disk_free_space() from disk_total_space() to calculate the free space on the disk.

$total_space = disk_total_space('/path/to/disk');
$free_space = disk_free_space('/path/to/disk');
$used_space = $total_space - $free_space;

echo "Total Space: " . $total_space . " bytes\n";
echo "Free Space: " . $free_space . " bytes\n";
echo "Used Space: " . $used_space . " bytes\n";