如何在前三個字符後添加一個句點,然後在後面的每3個字符?如何在前三個字符後添加一個句點,然後在後面的每3個字符?
Example
$number = 1100000
Output = 1'100.000
Example2
$number = 560000
Output = 560.000
Example3
$number = 1000256000
Output = 1'000'256.000
我試圖number_format但它會添加相同的符號(「)...謝謝!
$number = 1100000;
$english_format_number = number_format($number, 0, '.', "'");
Output: 1'100'000
$number = 1100000;
$english_format_number = number_format($number, 3, '.', "'");
Output: 1'100'000.000
$number = 1100000;
echo chunk_split($number,1,".");
謝謝!!
你能第一在尋求解決方案之前嘗試一些東西(編寫代碼)? –
你有沒有嘗試過自己? – anubhava
在格式化之前嘗試除以1000 – StephenTG