$s = ROUND(765.000); $i = strlen($s); if($i >= 4) { print substr($s,0,3); } else { print substr($s,0,2); }