Why have you got the Fatal Error: Call to undefined function money_format()?
Whenever you run the code related to currency, have you ever seen the Fatal Error: Call to undefined function money_format()? If this error appears, that means you use the function money_format()
in the system that doesn’t have strfmon capabilities. For instance, if you are utilizing Windows as a based system, the function money_format()
is undefined since Windows doesn’t have strfmon capabilities. You can read more information here.
So, if you are looking for a helpful solution to deal with this issue quickly, don’t hesitate to continue reading the blog today. Let’s move on to the fixing method now!
How to fix Fatal Error: Call to undefined function money_format()?
Because the function money_format()
doesn’t appear on your system, you should write your own function based on the number_format
function.
If you want to format the number as US dollars, it’s a great suggestion for you to use:
- Decimal =.
- Thousands =,
function asDollars($value) {
if ($value<0) return "-".asDollars(-$value);
return '$' . number_format($value, 2);
}
For example, the code line containing the error is:
$pricetotal = money_format("%10.2n", $pricetotal);
We will change it into:
$pricetotal = asDollars($pricetotal);
Wind-up
In conclusion, we hope that the recommended method above can help you address the trouble. If you have other ideas to remove the error, don’t hesitate to share them with us and other users by leaving your comment below.
Last but not least, we are offering a lot of mobile-friendly and eye-catching Joomla 4 Templates and free WordPress Themes. So, don’t forget to have a look at them and get the best one for your site. Hope you enjoy it and have a wonderful day.
- How to place menu items in helix joomla 5 ? - December 14, 2024
- How to reduce the size of helix 2 layout ? - December 14, 2024
- What’s J4 starter template and how to use it - December 3, 2024
Hi, I hace this problema but I don’t know where y can change this función, can hoy help me?? Thanks
Do you have same issue? So, did you try our solution?
No, because I don’t know un which archive I must put the code. Please, can you tell me where I can write this functión??
Thanks