disk_total_space Fonksiyonu

disk_total_space fonksiyonu, belirtilen disk veya bölümün toplam disk alanı boyutunu döndürür. Parametre olarak diskin yolu bir dize olarak iletilir. Fonksiyon, float türünde bir sayı olarak bayt miktarını döndürür.

Sözdizimi

phpdisk_total_space(directory);

Örnek

C diskinin toplam boyutunu alalım:

php<?php
  $res = disk_total_space('C:');
  echo $res;
?>

Kodun çalıştırma sonucu (örnek):

php256060440576

Örnek

Okunabilirliği artırmak için baytları gigabayta dönüştürelim:

php<?php
  $bytes = disk_total_space('C:');
  $gb = $bytes / 1024 / 1024 / 1024;
  echo round($gb, 2) . ' GB';
?>

Kodun çalıştırma sonucu (örnek):

php'238.47 GB'

Örnek

Başka bir diskteki mevcut alanı kontrol edelim:

php<?php
  $res = disk_total_space('D:');
  var_dump($res);
?>

Kodun çalıştırma sonucu (örnek):

phpfloat(512110881024)

Ayrıca Bakınız