Numbers with commas to separate the decimals

I would need to use numbers with commas to separate the decimals. EX. my number should look like this: 1,242.05 not 1,242.05
How can I do to solve my problem?

There is no difference between the two numbers.

yes, sorry. The automatic translator has changed the values. I write them again: 1.242,05 not 1,242.05
In Italy we use to put the decimals after the comma

You can use the PHP function number_format({value as number}, {how many decimal places}, {decimal indicator}, {thousand indicator}) to archive this.

number_format("1242.05", 2, ",", "."); // OUTPUTS: 1.242,05
number_format("1000000", 2, ",", "."); // OUTPUTS: 1.000.000,00

Read more from the PHP docs: PHP: number_format - Manual

1 Like