What is the PHP disk_total_space() function?

The disk_total_space() function in PHPHypertext Preprocessor is used to return the total number of bytes that are in the specified disk or filesystem.

Syntax


disk_total_space(directory)

Parameters

  • directory: It is used to specify the name of the disk whose size we want to check.

Return value

It returns the total size in bytes of the specified directory. It returns false in case of failure.

Code

The basic PHP code to demonstrate the use of the disk_total_space() function is as follows:

<?php
echo disk_total_space("D:");
?>

Explanation

The code above returns the total number of bytes in the D drive.

Free Resources