3
Guys, I have the following problem.
Follows my code:
$valores = '530222077.99';
$moeda = new NumberFormatter('pt_BR', NumberFormatter::CURRENCY);
$valores = $moeda->formatCurrency($valores, 'BRL');
echo $valores;
The following code returns to me: R$530.222.077,99
. But I need you to call me back 530.222.077,99
, that is to say without the R$
.
I’m having another problem. if I put a 2500 value it returns me 2,500 to the indez of 2,500.00. You know how to solve this?
– Hugo Borges
Testing
$moeda->setAttribute( NumberFormatter::MIN_FRACTION_DIGITS, 2 );
– Bacco
perfect worked 100%
– Hugo Borges
Could you give me one more help? I’m using the CURRENCY form to display totals in report, because it already comes with the R$. The problem is that when you format a negative number it looks like this: (R$4,444.44) Since I need it to look like this: R$-4,444.44 You know how to solve this?
– Hugo Borges
R$ -4.444,44 does not exist :) What you can do, is use an IF and put, for example, parentheses around (or a minus sign before the R$). As I commented on another occasion, if you really want to customize the output a lot, it is better to have a proper formatting function.
– Bacco
In case how do I get like this -R$4,444.44? Because there has to be a way for me to represent correct negative value?
– Hugo Borges