What is the PHP disk_total_space() function?

The disk_total_space() function in PHPHypertext Preprocessor is used to return the total number of bytes that are in the specified disk or filesystem.

Syntax


disk_total_space(directory)

Parameters

  • directory: It is used to specify the name of the disk whose size we want to check.

Return value

It returns the total size in bytes of the specified directory. It returns false in case of failure.

Code

The basic PHP code to demonstrate the use of the disk_total_space() function is as follows:

<?php
echo disk_total_space("D:");
?>

Explanation

The code above returns the total number of bytes in the D drive.

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources