PHP Disk_free_space () function

PHP

Returns the available space on the file system or disk partition. Disk_free_space() returns the number of bytes available on the corresponding file system or disk partition for the specified directory, entered as a string.Syntax:
float disk_free_space ($directory)
Parameters:The disk_free_space() function in PHP takes one parameter, which is $directory. This parameter specifies the directory to check.Return value:returns the available space on the file system or disk partition.Errors and exceptions :
  • The disk_free_space() function in PHP may give incorrect results if a file name is specified as a parameter instead of a directory.
  • The disk_free_space() function in PHP does not works for deleted files. It only works with files accessible to the server`s file system.
  • Examples :
    Input: disk_free_space ("D:"); Output: 10969328844 Input: disk_free_space ("C:"); Output: 10969327231
    The program below illustrates the disk_free_space() function:Program 1 :  
    // specifying a directory for checking free space echo disk_free_space ( "D: " );  
    ?>
    Output:
    10969328844
    Program 2 :  
    // specifying a directory for checking free space echo disk_free_space ( "C:" );  
    ?>
    Output:
    10969327231
    Link:
    http: // php. net / manual / en / function.disk-free-space.php



    Get Solution for free from DataCamp guru