Php Function Number_Format
Php function number_format is an inbuilt function that helps in formatting a given number in a group of thousands. It separates a thousand groups in the numbers passed in it by using commas or the other separators. It is useful when you want to separate the thousands of a given floating number or want to round off values upto specific digits. It takes the floating number in as parameter and returns the formatted number on success otherwise it gives E_WARNING on failure.
It accepts one, two or four parameters (not three) but the first and the last two are mandatory. The first one is the number that needs to be formatted while the second one is used to decide the position of the decimal point. The last one is used to decide the separator for separating the thousands.
If only the first one is specified then it will format the number without a decimal point while a comma is used as thousands separator. If the second one is specified then the number will be formatted by adding a dot in front of it and also a comma between every group of thousands. In case if the third one is specified then the number will be formatted while rounding it up. While the fourth one will format the number according to the separator that you have selected for the thousand group. This will make the number look much more readable and also give your users a better user experience while they are reading.