| Subject: | Re: PHP/MySQl/Apache |
|---|---|
| From: | Michael Fesser |
| Date: | Fri, 02 Nov 2007 20:54:27 +0100 |
| Newsgroups: | macromedia.dreamweaver.appdev |
.oO(Craig)
>FYI: The 'human' function displays either 'kb' or 'm' depending on the file
>size and executes perfectly.
JFTR: In my own framework I use this as a more general size formatting
function:
function sizeFormat($size, $base = 1024) {
$units = array(
1000 => array('B', 'KB', 'MB', 'GB', 'TB'),
1024 => array('B', 'KiB', 'MiB', 'GiB', 'TiB')
);
$power = floor(log($size, $base));
return $size > 0
? sprintf($power < 2 ? '%u %s' : '%.1f %s',
$size/pow($base, $power),
$units[$base][$power]
)
: 0;
}
Micha
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: call function PHP/MySQL/Apache, Craig |
|---|---|
| Next by Date: | Re: changes don't show, Murray *ACE* |
| Previous by Thread: | Re: PHP/MySQl/Apache, Craig |
| Next by Thread: | PHP, handling # in a string pass in the querystring, DEPearson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |