PHP 字符串 money_format() 函数

2024 年 9 月 4 日 | 阅读 1 分钟

PHP money_format() 函数是一个预定义函数。它用于将数字格式化为货币字符串。它返回数字的格式化版本。它包装了 C 库函数 strfmon(),并经常与 setlocale() 函数一起使用。

注意:此函数在 Windows 平台上不起作用。

语法

参数描述必需/可选
string指定要格式化的字符串。必需
数字要在 '%' 符号处插入的数字。必需

示例 1

输出

Your number is:1234.56
By using money_format() function:1.234,56 EUR

示例 2

输出

Your number is:-1234.5672
By using money_format() function:(******1234.57)

示例 3

输出

Your number is:-1234.5672
By using money_format() function:-USD 1,234.57

示例 4

输出

Your number is:-1234.5672
By using money_format() function:-EUR 1.234,57

下一主题PHP 字符串