diskfreespace()

diskfreespace() — Alias of disk_free_space().

Built-in function of PHP 8.5. The manual lists it as available in PHP 4, 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.

diskfreespace() is an alias of disk_free_space(): same parameters, same return value.

Signature

diskfreespace(string $directory): float|false

Parameters

ParameterTypeWhat it takes
$directorystringA directory of the filesystem or disk partition.

Return value

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

Example

A runnable snippet:

// $df contains the number of bytes available on "/" $df = disk_free_space("/"); // On Windows: $df_c = disk_free_space("C:"); $df_d = disk_free_space("D:");

All PHP 8.5 built-in functions

Reference card built from the PHP manual page diskfreespace() (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.