note 82165 added to function.round
| From: | admin at studio-gepard dot pl | Date: | Sat, 29 Mar 2008 21:08:59 +0000 |
| Subject: | note 82165 added to function.round | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137731@lists.php.net to get a copy of this message | ||
Here is basic function I sue to round file size. It gives as output text, so it's very easy to
use it in your applications.
$SIZE is file size in MB.
function output is text.
<?php
function sizetotext($SIZE){
if ($SIZE>=1024){
$SIZE=round($SIZE/1024,2);
return $SIZE."GB";
}else{
if ($SIZE>=1){
return $SIZE."MB";
}else{
$SIZE=$SIZE*1000;
return "~".$SIZE."KB";
}
}
}
?>
----
Server IP: 82.177.164.100
Probable Submitter: 83.26.174.219
----
Manual Page -- http://www.php.net/manual/en/function.round.php
Edit -- https://master.php.net/note/edit/82165
Del: integrated -- https://master.php.net/note/delete/82165/integrated
Del: useless -- https://master.php.net/note/delete/82165/useless
Del: bad code -- https://master.php.net/note/delete/82165/bad+code
Del: spam -- https://master.php.net/note/delete/82165/spam
Del: non-english -- https://master.php.net/note/delete/82165/non-english
Del: in docs -- https://master.php.net/note/delete/82165/in+docs
Del: other reasons-- https://master.php.net/note/delete/82165
Reject -- https://master.php.net/note/reject/82165
Search -- https://master.php.net/manage/user-notes.php