What function can be used in PHP to format numbers with specific decimal and thousand separators?

When working with numbers in PHP, you may need to format them with specific decimal and thousand separators for better readability. To achieve this, you can use the number_format() function in PHP. This function allows you to specify the number of decimal places, the decimal separator, and the thousand separator for a given number.

$number = 1234567.89;
$formatted_number = number_format($number, 2, '.', ',');
echo $formatted_number; // Output: 1,234,567.89