money_format() 函式是把字元串格式化為貨幣字元串的函式。
基本介紹
- 中文名:money_format
- string:規定要格式化的字元串
- number:被插入格式化字元串中
- 注釋:函式無法在 windows 平台上工作
語法
money_format(string,number) |
參數 | 描述 |
string | 必需。規定要格式化的字元串。 |
number | 可選。被插入格式化字元串中 % 符號位置的數字。 |
提示和注釋
例子 1
<?php $number = 1234.56; setlocale(LC_MONETARY, "en_US"); echo money_format("The price is %i", $number); ?> |
The price is USD 1,234.56 |
例子 2
<?php $number = -1234.5672; echo money_format("%=*(#10.2n", $number); ?> |
($********1,234.57) |