Level 122
Mar 9, 2016
3
Level 13
format input (number_format() )
User can input values like: -1.00 -1 -1,00
Now I need to return this values formated to the "comma" version (1->1,00 1.00->1,00). When I use:
number_format($request->amount, 2, ',','')
And use "1,00" as input I get this error:
A non well formed numeric value encountered
What's the best way to solve this, but being able to handle all three types of input though.
Please or to participate in this conversation.