How to remove commas from numbers in php
This article mainly introduces the relevant knowledge of "how to remove commas in php". The editor shows you the operation process through actual cases. The operation method is simple, fast and practical. I hope this article "how to remove commas in php" can help you solve the problem.
1. Remove the comma from the number through the str_replace function. Replace some characters in the string with other characters (case sensitive).
Echo str_replace ("," 10000000000.00 ")
Output:
10000000000.00
2. Remove the comma from the number through the number_format function. Format numbers by grouping in thousands of bits.
Note: this function supports one, two, or four parameters (not three).
Echo number_format (1235.369, 2, 6, 7, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
Output:
1235.37 this is the end of the introduction to "how to remove commas from php". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.