0
Good afternoon. I cannot convert the result of my function to thousands, I have tried to convert with some native functions of PHP unsuccessful.
function CafeGenerator() {
$data_inicial = "2019-02-10";
$data_atual = date('Y-m-d');
$valor_inicial = 19900;
$valor_a_somar = 30; // add 30 xicaras de café a cada dia
// faz a diferença entre as datas desejadas e converte para dias
$diferencaentredatasemmilissegundos =strtotime($data_atual) - strtotime($data_inicial);
$diferencaemdias = intval($diferencaentredatasemmilissegundos/86400);
// efetua a soma desejada
$valorfinal = $valor_inicial + ($diferencaemdias * $valor_a_somar);
return $valorfinal;
}
IMPRIME: 28120
Preciso do resultado: 28.120
Among these native functions, you tried to
number_format
?– Woss
Number Format not tried floatval etc..
– denis
I got $valor_formatted = number_format($final value,0,',','.'); Our was trying the hardest thank you.
– denis
I remove the admin question?
– denis
If you can, you can close as a duplicate of https://answall.com/q/11301/5878
– Woss