File: function.php

package info (click to toggle)
knowledgeroot 0.9.7.3-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 6,368 kB
  • ctags: 23,662
  • sloc: php: 6,113; sql: 171; perl: 133; xml: 132; makefile: 40
file content (22 lines) | stat: -rwxr-xr-x 498 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

	function getfilesize($byte,$precision = 2) {
                $a = 0;

                while($byte > 1024) {
	                $byte = round($byte / 1024,$precision);
	                $a++;
                }

		if($a == 0) $size = "B";
                elseif($a == 1) $size = "KB";
                elseif($a == 2) $size = "MB";
                elseif($a == 3) $size = "GB";
                else return "Wrong Size";
                
		$bsize = "$byte $size";
        
		return $bsize;
	}

?>