disk_free_space

Returns available space on filesystem or disk partition

Syntax

disk_free_space(string $directory): float|false

Parameters

directory

A directory of the filesystem or disk partition.

Note: Given a file name instead of a directory, the behaviour of the function is unspecified and may differ between operating systems and PHP versions.

Return

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

Examples

1

<?

$directory = "/";

$return = disk_free_space($directory);

echo $return;

?>
191542976512

2 · windows

<?

$directory = "C:";

$return = disk_free_space($directory);

echo $return;

?>
191542956032
HomeMenu