<?php php
$number = 1234; spa
// english notation (default)
$english_format_number = number_format($number);
echo "First:".$english_format_number."<br />"; orm
// French notation
$nombre_format_francais = number_format($number, 2, ',', ' ');
echo "Second:".$nombre_format_francais."<br />"; it
// French notation
$number = 1234.564;
$nombre_format_francais = number_format($number, 2, ',', ' ');
echo "Third:".$nombre_format_francais."<br />";
$number = 1234.5678; io
// english notation without thousands seperator
$english_format_number = number_format($number, 2, '.', '');
echo "Forth:".$english_format_number."<br />"; form
?> 方法
顯示結果最終以下: First:1,234 Second:1234,00 Third:1234,56 Forth:1234.57