$number = 1234567.89;
$formatted_number = number_format($number);
echo $formatted_number; // 输出:1,234,567.89
$number = 1234.56789;
$formatted_number = number_format($number, 2);
echo $formatted_number; // 输出:1,234.57
$number = 1234.56789;
$formatted_number = number_format($number, 2, ',', '.');
echo $formatted_number; // 输出:1.234,57
$number = -1234.56789;
$formatted_number = number_format($number, 2);
echo $formatted_number; // 输出:-1,234.57
$number = 1234567.89;
$formatted_number = number_format($number, 2, '.', '');
echo $formatted_number; // 输出:1234567.89
$number = 1.2e6;
$formatted_number = number_format($number, 0);
echo $formatted_number; // 输出:1,200,000
这些是一些常见的使用技巧,根据具体需求,可以灵活运用number_format函数来格式化数字。