using the disk free space function in php

here is a built in php function that will show the amount of free space available on your server.


$bytes = disk_free_space("."); 
  $si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
  $base = 1024;
  $classx = min((int)log($bytes , $base) , count($si_prefix) - 1);
  $template_result = "";
  $template_result .= $bytes . '<br />';
  $template_result .= sprintf('%1.2f' , $bytes / pow($base,$classx)) . ' ' . $si_prefix[$classx] . ' free';
23.08 GB free

Other Items in php
Page Views

This page has been viewed 205 times.

Search Code
Search Code by entering your search text above.

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.


Random Quote
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better. You won't believe what you can accomplish by attempting the impossible with the courage to repeatedly fail better.