php8.5
Home/ Manual/ filesystem / functions/ disk_total_space

disk_total_space

PHP function Edit on GitHub ✎

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)

Returns the total size of a filesystem or disk partition

Description

disk_total_space(string $directory): float|false

Given a string containing a directory, this function will return the total number of bytes on the corresponding filesystem or disk partition.

Parameters

directory

A directory of the filesystem or disk partition.

Return Values

Returns the total number of bytes as a float Falseforfailure.

Examples

disk_total_space() example

php
<?php
// $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:");
?>

Notes No-remote

See Also

Source: reference/filesystem/functions/disk-total-space.xml · from the official PHP manual (php/doc-en)