Are there any best practices for handling decimal formatting in PHP?

When working with decimal numbers in PHP, it is important to ensure proper formatting to avoid potential rounding errors or inconsistencies. One common best practice is to use the number_format() function to format decimal numbers with a specified number of decimal places.

$number = 123.456789;
$formatted_number = number_format($number, 2); // Output: 123.46

echo $formatted_number;