I'm doing my project in php version 7.1.8 in laravel framework but I get this error when I use Call to undefined function App \ Http \ Controllers \ money_format () can someone help me?
I'm doing my project in php version 7.1.8 in laravel framework but I get this error when I use Call to undefined function App \ Http \ Controllers \ money_format () can someone help me?
money_format
does not work on some systems. For example, if you are testing the code in Windows, it will give you the error Undefined
. The PHP Manual says in a note :
The
money_format()
function is only defined if the system has capacitystrfmon
. For example, Windows does not do it, somoney_format()
is not defined in Windows.
In the contribution notes of the same Manual there is a function by Rafael M. Salvioni that you can implement, as it works on Windows.
Or you can opt for a simpler implementation, depending on what you want to do. For example, in this SO answer in English show a simple way to format dollars:
function asDollars($value) {
return '$' . number_format($value, 2);
}
With these two starting points, you will be able to face the problem with your own function, adapted to the needs of your application.