How can one control the precision of decimal numbers in PHP calculations?

When performing calculations with decimal numbers in PHP, the precision of the result can sometimes be unexpected due to the way floating-point numbers are represented internally. To control the precision of decimal numbers in PHP calculations, you can use the `number_format()` function to format the result to a specific number of decimal places.

$number1 = 10.25;
$number2 = 3.5;

$result = $number1 * $number2;

// Control the precision to 2 decimal places
$precision = 2;
$formatted_result = number_format($result, $precision);

echo $formatted_result; // Output: 35.88