Getting fatal error in money_format function

php

Solution

From the manual:

The function `money_format()` is only defined if the system has `strfmon` capabilities. For example, Windows does not, so `money_format()` is undefined in Windows.

`money_format()` is basically a wrapper around the C library function `strfmon()` as the manual states.

If you check the comments, there is an implementation by Rafael M. Salvioni. Worth a try. You can check if it's already defined using function_exists().

Answers to this StackOverflow question give further (and possibly better) alternatives (thx danielson317).

Problem

Why does this error occurs? code: ``` setlocale(LC_MONETARY, "en_US"); $pricetotal = money_format("%10.2n", $pricetotal); ``` Server details. ``` Apache Version : 2.2.21 PHP Version : 5.3.8 ``` I'm getting the following Error ``` Fatal error: Call to undefined function money_format() ```

Original source

Related problems