PHP Function Reference

PHP disk_total_space() Function



The PHP disk_total_space() function returns the total space, in bytes, available on the specified filesystem or disk partition.

Note: This function does not work on remote files as the file to be examined must be accessible via the server's filesystem.

Syntax

disk_total_space(directory)

Parameters

directory Required. Specify a directory of the filesystem or disk partition.

Return Value

Returns the number of available bytes as a float or false on failure.

Example:

The example below shows the usage of disk_total_space() function.

<?php
//number of bytes available on "/"
echo disk_total_space("/")."\n";

//on Windows
echo disk_total_space("C:")."\n";
echo disk_total_space("D:")."\n";
?>

The output of the above code will be:

20629221376
25396712451
33345856739

❮ PHP Filesystem Reference