Guest User

Show size of the server

a guest
May 30th, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. <?php
  2.     $bytes = disk_free_space(".");
  3.     $si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
  4.     $base = 1024;
  5.     $class = min((int)log($bytes , $base) , count($si_prefix) - 1);
  6.     echo sprintf('%1.2f' , $bytes / pow($base,$class)) . ' ' . $si_prefix[$class] . '';
  7. ?>
Advertisement
Add Comment
Please, Sign In to add comment