Reply to Re: File Size Conversion

Your name:

Reply:


Posted by Richard Morton on 12/19/05 15:50

Hi Prince of Code,

What you are asking is quite simple. But with a name like Prince Of Code
it looks like you're too lazy to do the ground work and learn the basics
of the language.

I am sure you'll appreciate that we have our own projects to complete
and so can't hand hold people through every step of the learning process.

You might want to look at a simple function like this though (untested)

function readableFilesize($bytes){
switch(TRUE){
case ($bytes<1024)
return ($bytes . "bytes");
break;
case ($bytes>1023)
return ($bytes/1024 . "KB");
break;
case ($bytes>104858)
return ($bytes/1000000 . "MB");
break;
}
}


now, I'm not doing the rest for you, you need to look for someway to
round the answers and add it into the returns

www.php.net and look for rounding functions.

HTH - but please do some work yourself before posting!

Rich


Prince of Code wrote:
> Can anybody help me out by writing a function for the given problem
>
> Write a function in PHP that converts given number of bytes into
> Readabel format like 99.92 KB for 102323 bytes and
> 3 MB for 3072 bytes and so on. Let your function be
> sophasticated,portable,easy readable.
>
> Thankzz in advance
> Napoleon
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация