1. Go to this page and download the library: Download chrisullyott/php-filesize library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
chrisullyott / php-filesize example snippets
use ChrisUllyott\FileSize;
$size = new FileSize('500 GB');
echo $size->as('MB'); // 512000
echo $size->as('megabytes'); // 512000
echo $size->as('TB', 3); // 0.488
$size = new FileSize('1234522678.12 KB');
echo $size->asAuto(); // '1.15 TB'
$size = new FileSize('1234522678.12 KB');
echo $size->asAuto(5); // '1.14974 TB'