What are some best practices for handling number formatting in PHP to ensure consistency across different regions?

When handling number formatting in PHP to ensure consistency across different regions, it is best to use the number_format function with appropriate parameters such as the number of decimal places, decimal point, and thousands separator. Additionally, using the setlocale function to set the desired locale can help ensure consistent formatting across different regions.

// Set the locale to a specific region
setlocale(LC_NUMERIC, 'en_US');

// Format a number with 2 decimal places, comma as thousands separator, and period as decimal point
$number = 12345.67;
$formatted_number = number_format($number, 2, '.', ',');
echo $formatted_number;