What are the potential pitfalls of using the round() function in PHP for reducing decimal places?

The potential pitfall of using the round() function in PHP for reducing decimal places is that it uses the round half to even strategy, which may not always give the desired result. To solve this issue, you can use number_format() function which allows you to specify the number of decimal places and the rounding method.

$number = 10.555;
$rounded_number = number_format($number, 2, '.', ''); // Rounds to 2 decimal places
echo $rounded_number; // Output: 10.56