-1
I have to transform values like:
3200
5000
10000
13000
100000
in
3.200
5.000
10.000
13.00
100.000
I tried to use the function number_format
of PHP
but I could not do it correctly. How can I solve this problem ?
-1
I have to transform values like:
3200
5000
10000
13000
100000
in
3.200
5.000
10.000
13.00
100.000
I tried to use the function number_format
of PHP
but I could not do it correctly. How can I solve this problem ?
1
You can elaborate as follows:
function formata_valor($valor){
if($valor!=NULL){
echo number_format($valor, 0, ',', '.');
} else {
echo "Nenhum valor foi preenchido.";
}
}
echo formata_valor("10000"); // output 10.000
Reference documentation: http://php.net/number_format
It worked out! Thank you.
No reason Alisson, the mood!
Here is the suggestion to explain what each parameter does to value the answer. Not everyone reads the recommended links. In fact not everyone reads the answers carefully :)
Relax, I put the documentation as a reference too... But as I responded quickly, I ended up not completing much of the explanation. But I appreciate your touch! :)
If completed, it is even easier to use to close future duplicates with the same doubt (and attracts more votes of "toast") :)
Okay, I’ll make a better explanation ;)
Browser other questions tagged php number-format
You are not signed in. Login or sign up in order to post.
How you tried?
– Sr. André Baill
number_format($variavel, 2, '.', '.');
– Alisson Acioli
and what your return ?
– Sr. André Baill
number_format ($variable, 0 , ' , ' , '.');
– Sr. André Baill
3.200.00 with . 00 dps and do not want that.
– Alisson Acioli