1
I have an input with a mask where the user type the desired price and automatically is formatted. Before sending to the database, I transform this value so I can work with it with some arithmetic operation.
Example:
$preco = "2.199,99"
$preco = str_replace(".", "", $preco);
$preco = str_replace(",", ".", $preco);
//No final o valor inserido no banco de dados será 2199.99
This value, after registration, will appear in a table, I would like it to come in the same way as when it was formatted. Replace again the .
for ,
, but how will I insert a .
for every three numbers?
I didn’t know this function, thank you!
– Afuro Terumi