To get the total disk space of the system in PHP, the disk_total_space()
function can be used. This function returns the total size of a given directory in bytes. If no directory is specified, it will return the total size of the partition the PHP script is running on. Here is an example code:
main.php100 chars5 lines
In this example, disk_total_space()
function is called with the root directory path “/”. The function returns total disk space in bytes and prints it using echo
. This code will output the total disk space in bytes of the system where it is running.
gistlibby LogSnag