Computer >> Computer tutorials >  >> Programming >> PHP

diskfreespace() function in PHP


The diskfreespace() function returns the available free space in a directory and is an alias of disk_free_space().

Syntax

diskfreespace(dir_name)

Parameters

  • dir_name − Directory to be specified.

Return

The diskfreespace() function returns the free space in bytes.

Example

<?php
   echo diskfreespace("/home/");
?>

Output

832931168256

Let us see another example.

Example

<?php
   $free_space = diskfreespace("/home/");
   echo "Free Space: $free_space";
?>

Output

Free Space: 832931168256