티스토리 뷰

 

$num = 3.14;

 

: 올림

$num = ceil($num);

결과 : 4

 

: 버림

$num = floor($num);

결과 : 3

 

: 반올림

$num = round($num);

결과 : 3

 

소수점 1 자리 진행

$num = round($num, 1); // 파라미터가 하나 더 있으면 소수 점 자리 수를 의미 한다.

결과 : 3.1

 

################ 개시글 별점 평균 (VIEW) ################
$sql="select round(avg(`rating`),1) as `cnt` from `".$DB_TABLE."_rating` where isdel='0' and `widx`='".$idx."' ";
$rs=$conn->Execute($sql);
$total_avg_rating=$rs->fields['cnt'];
//$total_avg_rating= ceil($total_avg_rating, 1); 
$rs->close();
Total
Today
Yesterday
최근에 올라온 글
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30