在money_format函数中出现致命错误

Par*_*i04 10 php

为什么会出现此错误?

码:

setlocale(LC_MONETARY, "en_US");
$pricetotal = money_format("%10.2n", $pricetotal);
Run Code Online (Sandbox Code Playgroud)

服务器细节.

Apache Version : 2.2.21  
PHP Version : 5.3.8 
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

Fatal error: Call to undefined function money_format() 
Run Code Online (Sandbox Code Playgroud)

kap*_*apa 15

手册:

该功能money_format()如果系统有只被定义strfmon 功能.例如,Windows没有,因此money_format()在Windows中未定义.

money_format()基本上是C库函数的包装器,strfmon()如手册所述.

如果您查看评论,Rafael M. Salvioni将实施.值得一试.您可以使用function_exists()检查它是否已经定义.

这个StackOverflow问题的答案给出了更多(可能更好)的替代方案(thx danielson317).