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