Are there any best practices for handling numerical formatting in PHP to ensure consistency?

When handling numerical formatting in PHP, it is important to ensure consistency in how numbers are displayed to users. One way to achieve this is by using PHP's number_format function, which allows you to format numbers with a specified number of decimal places, thousands separator, and decimal point.

// Example of formatting a number with two decimal places and a comma as a thousands separator
$number = 1234567.89;
$formatted_number = number_format($number, 2, '.', ',');
echo $formatted_number;