What is the recommended PHP function for formatting numbers with a specific separator for currency values?

When formatting numbers as currency values in PHP, it is recommended to use the number_format() function. This function allows you to specify the number of decimal places, the decimal separator, and the thousands separator. By using number_format(), you can easily format numbers as currency values with the desired separator.

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