PHP code example of technodelight / bytes-in-human

1. Go to this page and download the library: Download technodelight/bytes-in-human 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/ */

    

technodelight / bytes-in-human example snippets


 
 
 use Technodelight\BytesInHuman\BytesInHuman;
 
 $bytes = BytesInHuman::fromBytes(1024);
 echo $bytes->asString(); // 1.00K
 echo $bytes; // 1.00K, as it's converted to string with __toString magic method