/var/log/step2k

October 18, 2007

ROUNDUP Excel

Filed under: Project, PHP - Salman Teguh @ 6:56 am

Berikut ini adalah fungsi untuk roundup sehingga outputnya sama dengan fungsi roundup excel.

function roundup ($num, $digits) {
$shift = pow(10 , $digits);
$rounds=$shift-$num;
if ($rounds<0){
$mod=ceil($num/$shift);
$shift=$shift*$mod;
$rounds=$shift-$num;
}
return ($num+$rounds);
}

Get free blog up and running in minutes with Blogsome
Theme designed by Alex King