Ver Mensaje Individual
  #9 (permalink)  
Antiguo 09/09/2005, 04:10
Shockly
 
Fecha de Ingreso: agosto-2005
Mensajes: 109
Antigüedad: 18 años, 8 meses
Puntos: 0
Si quieres algo más elegante o al menos universalizable....

Código PHP:
[...]
    echo( 
"<br><pre>" );
    
SpaceUsed$path );
    echo( 
"<br><br> total = " HumanReadableSize($total) . "<br>" );
    echo( 
"</pre><br>" );


siendo

    
function HumanReadableSize($sizeInBytes) {
        
settype($sizeInBytes"double");
        if (
$sizeInBytes 1073741823)
            return 
rtrim(number_format($sizeInBytes/10737418242),"0.")."&nbsp;Gb";
        else if (
$sizeInBytes 1048575)
            return 
rtrim(number_format($sizeInBytes/10485762),"0.")."&nbsp;Mb";
        else if (
$sizeInBytes 1023)
            return 
rtrim(number_format($sizeInBytes/1024,2),"0.")."&nbsp;Kb";
        else
            return 
"$sizeInBytes bytes";
    }