//소수점없이 정수형식으로 표시
function sosu0($val_nt){
return number_format($val_nt, 0, '.', ',');
}
//소수점 1자리까지표시
function sosu1($val_nt){
if($val_nt < 0.01){ return 0; }
$tmp = number_format($val_nt, 1, '.', ',');
$cnt = strlen($tmp)-1;
//불여우에서 이상한 문자로 표현되는 오류가 있다. 문자열의 배열에는 있는데 없는걸로 처리해서 오류나므로 꽁수로 처리
while(($tmp[$cnt]=='0')||($tmp[$cnt]=='.')){ if($tmp[$cnt]=='.'){ $tmp[$cnt]=' '; break; } else { $tmp[$cnt]=' '; $cnt -=1; } }
return str_replace(' ', '', $tmp);
}
//소수점 2자리까지표시
function sosu2($val_nt){
if($val_nt < 0.01){ return 0; }
$tmp = number_format($val_nt, 2, '.', ',');
$cnt = strlen($tmp)-1;
//불여우에서 이상한 문자로 표현되는 오류가 있다. 문자열의 배열에는 있는데 없는걸로 처리해서 오류나므로 꽁수로 처리
while(($tmp[$cnt]=='0')||($tmp[$cnt]=='.')){ if($tmp[$cnt]=='.'){ $tmp[$cnt]=' '; break; } else { $tmp[$cnt]=' '; $cnt -=1; } }
return str_replace(' ', '', $tmp);
}
//소수점 3자리까지표시
function sosu3($val_nt){
if($val_nt < 0.001){ return 0; }
$tmp = number_format($val_nt, 3, '.', ',');
$cnt = strlen($tmp)-1;
//불여우에서 이상한 문자로 표현되는 오류가 있다. 문자열의 배열에는 있는데 없는걸로 처리해서 오류나므로 꽁수로 처리
while(($tmp[$cnt]=='0')||($tmp[$cnt]=='.')){ if($tmp[$cnt]=='.'){ $tmp[$cnt]=' '; break; } else { $tmp[$cnt]=' '; $cnt -=1; } }
return str_replace(' ', '', $tmp);
}