What are some potential pitfalls when using the round() function in PHP?
One potential pitfall when using the round() function in PHP is that it may not always return the expected result due to the way floating-point numbers are represented in computers. To mitigate this issue, you can use the number_format() function to round a number to a specified number of decimal places.
// Using number_format() to round a number to 2 decimal places
$number = 10.555;
$rounded_number = number_format($number, 2);
echo $rounded_number; // Output: 10.56