Are there any built-in PHP functions or libraries that can help with formatting float values for display purposes?

When working with float values in PHP, it's common to encounter the need to format these values for display purposes, such as limiting the number of decimal places or adding thousands separators. PHP provides several built-in functions and libraries that can help with this task, such as number_format() for adding thousands separators and controlling decimal precision.

$floatValue = 1234.56789;
$formattedValue = number_format($floatValue, 2); // Output: 1,234.57
echo $formattedValue;