number_format函数用于格式化数字,并返回格式化后的字符串。
语法: number_format(number, decimals, decimal_separator, thousands_separator)
参数:
示例:
$number = 12345.6789; $formatted_number = number_format($number, 2, ".", ","); echo $formatted_number; // 输出:12,345.68