output: 1,000,000 1,000,000.00 1.000.000,00 Interesting number_format number_format(number,decimals,decimalpoint,separator) has four parameters, The first and second parameters are required, the third and fourth are optional. However, in actual testing, the third and fourth parameters must exist at the same time, that is, either both are set or neither is set. The third and fourth parameters are not set:
If you add up the processed numbers, you will only get 13! . The third and fourth parameters are set
If you perform operations on the processed numbers at this time, it will be executed correctly! The third parameter of this function indicates what the ‘decimal point’ position is used to represent. It can default to . or can be set to ‘,’ and other symbols. Ps: But I believe no one would do this. The fourth one indicates how to divide the number into every thousandth place. If there are no special requirements and operations are to be performed, it is best to set it to empty. |