PHP Numeric Format Function Number_format Introduction, Number_format (the number to be formatted, the number of decimal places to keep, the string of decimals, thousands separator). Number_format function Number_format (the number to be formatted, the number of decimal places to keep, the string of decimals, thousands separator)//Total 4 Parameters The function of the Number_format is to format the number. In the 4 parameters listed above , the first required option, and the others are optional. Parameter description: The number to be formatted (not interpreted) the number of decimal places (optional) that is reserved after formatting the number is prepared to retain several fractional decimal point strings (optional) by default. If you want to use the * number as the decimal point, the parameter value is * For example: 189*00 (189 reserved 2 decimal places, * is the decimal point) thousands separator (optional) By default, if you want to specify a different symbol to be separated by thousands, the parameter value is the semicolon you want to specify, for example: 189^000^000.00 here with the symbol ^ to Acts as a thousands separator. Example: Number_format (288);--Output 288 number_format (365,2);--Output 365.00 Number_format (365000000,3, ".") (The number 365000000 is reserved for 3 decimal places, and the decimal point is ".") Representation)--output: 365,000,000.000 Number_format (365000000,2, ".", "*") (the number 365000000 is reserved for 2 decimal places, and the decimal point is ".") Indicates that the thousand separator is denoted by "*")--Output: 365*000*000.00 |