reenadak icon

function filesize

reenadak | PRO | 09/25/17 06:45:19 PM UTC | 0 ⭐ | 318 👁️ | Never ⏰ | []
PHP |

620 B

|

None

|

0 👍

/

0 👎

// remainder
//echo date('d'); 
 
echo fmod(date('d'), 6);
// fmod return the remainder.
 
// function filesize
function niceSize($size)
{
   
    define("SIZESTEP", 1024.0);
   
    static $sizeUnits = Array(" B","KB","MB","GB","TB","PB","EB");
   
    if($size==="") return "";
   
    $unitIndex = 0;
 
    while($size>SIZESTEP)
    {
        $size = $size / SIZESTEP;
        $unitIndex++;
    }
   
    if($unitIndex==0) {
        return number_format($size, 0)." ".$sizeUnits[$unitIndex];
    } else {
        return number_format($size, 1, ".", ",")." ".$sizeUnits[$unitIndex];
    }
}

Comments