PHP disk_free_space( ) Function Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The disk_free_space() function in PHP is an inbuilt function which is used to return the amount of free space in a specified directory. The disk_free_space() function denotes the free space in bytes. It returns the available space on a filesystem or on a disk partition. The disk_free_space() function returns the number of bytes available on the corresponding filesystem or disk partition for a specified directory inputted as a string. Syntax: float disk_free_space ( $directory ) Parameters: The disk_free_space() function in PHP accepts one parameter which is $directory. This parameter specifies the directory which has to be checked. Return Value: It returns the available space on a filesystem or on a disk partition. Errors And Exception: The disk_free_space() function in PHP may give improper results if a file name is given as parameter instead of a directory. The disk_free_space() function in PHP doesn't works for remote files.It only works on files which are accessible by the server's filesystem. Examples: Input : disk_free_space("D:"); Output : 10969328844 Input : disk_free_space("C:"); Output : 10969327231 Below program illustrates the disk_free_space() function: Program 1: php <?php // specifying directory to check for free space echo disk_free_space("D:"); ?> Output: 10969328844 Program 2: php <?php // specifying directory to check for free space echo disk_free_space("C:"); ?> Output: 10969327231 Reference: https://www.php.net/manual/en/function.disk-free-space.php Create Quiz Comment S Shubrodeep Banerjee Follow 0 Improve S Shubrodeep Banerjee Follow 0 Improve Article Tags : Misc Web Technologies PHP PHP-input-output Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like