-3
I want to return a value of a variable, only when I insert the number_format function into the variable, it ends up adding 2 zeros at the end of the value
$valor = 5300000; // Aqui o número só está sem a formatação | aqui só adicionaria a virgula e o ponto e ficaria: 53,000.00
$valor_f = number_format($valor, 2, ",", ".");
He’s returning me 5,300,000.00, I’d like you to return 53,000.00.
If you need to convert the number 5 million and 300 to 53 ml it is not just with formatting that you will get. You will need to split by 100 before.
– Woss
Anyway, if you take the decimal separation character of a number you will get another value. If you need to undo the process, you have to split it. The problem is
3.14159
, pi value; if you remove the formatting will be314159
. How will you know how many decimal places the number needs to be?– Woss