$number = 12.3456789; $rounded_number = sprintf("%.2f", $number); print $rounded_number; # prints 12.35