PHP code example of ramazancetinkaya / byte-formatter
1. Go to this page and download the library: Download ramazancetinkaya/byte-formatter 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/ */
ramazancetinkaya / byte-formatter example snippets
amazancetinkaya\ByteFormatter;
// Create an instance of ByteFormatter
$formatter = new ByteFormatter();
// Format bytes
echo $formatter->format(2048); // Output: 2 KB
// Convert from human-readable size to bytes
echo $formatter->convertToBytes('2 KB'); // Output: 2048