I wanted to format a price number with two decimal places, for example 1245, here's what I did.
More
//code sample
number_format(1245, 2, '.', ',');
//output is 1,245.00
//First parameter (1245) is our input number
//Second paramter (2) is the number of decimal places you want
//Third parameter ('.') is the character for decimal separator
//Fourth parameter (',') is the character for thousands separator
number_format(1245, 2, '.', ',');
//output is 1,245.00
//First parameter (1245) is our input number
//Second paramter (2) is the number of decimal places you want
//Third parameter ('.') is the character for decimal separator
//Fourth parameter (',') is the character for thousands separator


