Are there any potential pitfalls or issues with using string manipulation for formatting numerical data in PHP, as seen in the provided code snippet?

One potential pitfall of using string manipulation for formatting numerical data in PHP is that it may not handle all cases correctly, especially with different locales or number formats. To solve this issue, it is recommended to use PHP's number_format() function, which provides a more robust and reliable way to format numerical data.

// Original code snippet using string manipulation
$number = 1234567.89;
$formatted_number = number_format($number, 2, '.', ',');
echo $formatted_number;