PHP | disk_free_space( ) Function

Configurare noua (How To)

Situatie

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.

Solutie

Pasi de urmat
  • 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.
Input : disk_free_space("D:");
Output : 10969328844
Program 1:
Input : disk_free_space("C:");
Output : 10969327231

<?php

// specifying directory to check for free space
echo disk_free_space(“D:”);

?>

 

Program 2:

<?php

// specifying directory to check for free space
echo disk_free_space(“C:”);

?>

 

Tip solutie

Permanent

Voteaza

(2 din 3 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?