<?php
$filesize = 17878788;
$result = null;
if ($filesize < 1048576)
$result = round(($filesize / 1024), 2) . 'KB';
else if ($filesize < 1073741824)
$result = round(($filesize / 1048576), 2) . 'MB';
else
$result = round(($filesize / 1073741824), 2) . 'GB';
echo $result;
'프로그램 경험 > PHP' 카테고리의 다른 글
[PHP] 파일 UTF-8로 저장하기 (0) | 2012.04.12 |
---|---|
[PHP] 파일 다운로드 (0) | 2012.04.10 |
[PHP] JSON 사용 (0) | 2012.03.23 |
[PHP] 난수 생성 (0) | 2012.03.22 |
[PHP] xml 데이터 submit 하기 (0) | 2012.03.14 |