disk_total_space()
disk_total_space() — Returns the total size of a filesystem or disk partition.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
Given a string containing a directory, this function will return the total number of bytes on the corresponding filesystem or disk partition.
Signature
disk_total_space(string $directory): float|false
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $directory | string | A directory of the filesystem or disk partition. |
Return value
Returns the total number of bytes as a float or false on failure.
Example
A runnable snippet:
// $ds contains the total number of bytes available on "/" $ds = disk_total_space("/"); // On Windows: $ds = disk_total_space("C:"); $ds = disk_total_space("D:");
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page disk_total_space() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.