PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function myRound($n) { $log = (int)log10($n); $res = ceil($n/10**($log-1)); echo $res; return $res * 10**($log-1); } printf ("%d >> %d", 1256, myRound(1256)); //echo round(1256, -(int)log10(1256)); // 1256 »» 1300 //1200,98 »» 1300 //138 »» 140 //11,01 »» 12
Show:  
Copy Clear