usually with Number_format (); To format a number, by default the thousand characters are separated by commas, such as:
Copy the Code code as follows:
Echo Number_format ("10000.01231", 2);
Take 2 digits after the decimal point, the result of the output is: 10,000.1000 bits default is comma interval.
It would be a bit of a struggle if we were to verify that the numbers obtained from the client were in the background.
Lao Tong commonly used Filter_input (Input_post, "price", filter_validate_float) to verify the prices, if it is a comma with a thousand character will not be obtained.
Therefore, when you confirm that the input is a number, you must filter out all thousand characters before verifying.
In fact, few people will enter a number with a thousand character, unless it is copied or the original output value is resubmitted.
In the output we can minimize the use of a number format with thousands of characters, the output can be written like this:
Copy the Code code as follows:
Format_number ("10000.01231", 2, ".", "");
So the output is 10000.01.
The above describes the comma-separated value file PHP with a comma thousands of digits of the processing method, including the comma-separated values of the contents of the file, I hope to be interested in PHP tutorial friends helpful.