PHP disk_free_space() Function
The PHP disk_free_space() function returns the free 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_free_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_free_space() function.
<?php //number of bytes available on "/" echo disk_free_space("/")."\n"; //on Windows echo disk_free_space("C:")."\n"; echo disk_free_space("D:")."\n"; ?>
The output of the above code will be:
10376712192 15352312451 23289895439
❮ PHP Filesystem Reference