lo que hace es trasformar el tamaño de un archivo osea
201545728 esto es el tamaño del archivo
y como deberia estar
201 MB
este codigo lo hace pero quisas es muy engorroso mi pregunta se puede hacer esto con menos pasos
Código PHP:
if (strlen($torrent["info"]["length"]) >= 11){
$show_filesize = substr($torrent["info"]["length"],0,2)."GB";
}
elseif (strlen($torrent["info"]["length"]) >= 10){
$show_filesize = substr($torrent["info"]["length"],0,1)."GB";
}
elseif (strlen($torrent["info"]["length"]) >= 9){
$show_filesize = substr($torrent["info"]["length"],0,3)."MB";
}
elseif (strlen($torrent["info"]["length"]) >= 8){
$show_filesize = substr($torrent["info"]["length"],0,2)."MB";
}
elseif (strlen($torrent["info"]["length"]) >= 7){
$show_filesize = substr($torrent["info"]["length"],0,1)."MB";
}
elseif (strlen($torrent["info"]["length"]) >= 6 ){
$show_filesize = substr($torrent["info"]["length"],0,3)."KB";
}
elseif (strlen($torrent["info"]["length"]) >= 5 ){
$show_filesize = substr($torrent["info"]["length"],0,2)."KB";
}
elseif (strlen($torrent["info"]["length"]) >= 5 ){
$show_filesize = substr($torrent["info"]["length"],0,1)."KB";
}
else{
$show_filesize = "0 KB";
}j
osea que esto
201545728
lo transforman a
192.1 MB
salu2
Informacion de ultimo hora
ME equivoque el tema por que aparece redondeado el tamaño del archivo es por que 1 mb son 1024 kb
![borracho](http://static.forosdelweb.com/fdwtheme/images/smilies/borracho.png)
![borracho](http://static.forosdelweb.com/fdwtheme/images/smilies/borracho.png)
salu2