Skip to content

Instantly share code, notes, and snippets.

@mikesherov
mikesherov / gist:1001480
Created May 31, 2011 23:16
Silly way to round two numbers to the least granular precision PHP
<?php
function dec_points($val){
$precision = 0;
while($precision < 10){
if($val == round($val, $precision)){
break;
}
$precision++;
}