usually with Number_format (); To format a number, by default the thousand characters are separated by commas, such as:
Copy CodeThe code is 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 CodeThe code is as follows:
Format_number ("10000.01231", 2, ".", "");
So the output is 10000.01.
http://www.bkjia.com/PHPjc/324757.html www.bkjia.com true http://www.bkjia.com/PHPjc/324757.html techarticle usually use Number_format (), to format the number, by default the thousand characters are separated by commas, for example: Copy code code is as follows: Echo Number_format ("10000.01231", 2);//Take the decimal point ...