Hello, there!
I wrote this message because when using disk_total_space I got a different result than the one in the book. I suspect that my computer generates a different result. Am I right? Any suggestions are welcome. Thanks for your attention.
//for php 5.3. or 5.4
$systempartitions = array("/", "/home","/usr", "/var");
foreach ($systempartitions as $partition) {
$totalSpace = disk_total_space($partition) / pow(1024, 2);
$usedSpace = $totalSpace - disk_free_space($partition) / pow(1024, 2);
echo "Partition: $partition (Allocated: $totalSpace MB. Used: $usedSpace MB.)\n";
}
My output:
Partition: / (Allocated: 50079.953125 MB. Used: 21962.6875 MB.)
Partition: /home (Allocated: 50079.953125 MB. Used: 21962.6875 MB.)
Partition: /usr (Allocated: 50079.953125 MB. Used: 21962.6875 MB.)
Partition: /var (Allocated: 50079.953125 MB. Used: 21962.6875 MB.)
The result given in the book:
Partition: / (Allocated: 3099.292 MB. Used: 343.652 MB.)
Partition: /home (Allocated: 5510.664 MB. Used: 344.448 MB.)
Partition: /usr (Allocated: 4127.108 MB. Used: 1985.716 MB.)
Partition: /usr/local/apache2/htdocs (Allocated: 4127.108 MB. Used: 1985.716 MB.)