How does PHP delete a comma in a string
This article mainly introduces "how PHP deletes commas in strings". In daily operation, I believe many people have doubts about how to delete commas in strings in PHP. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to delete commas in strings by PHP". Next, please follow the editor to study!
1. The str_replace () function: replaces some characters in the string (case sensitive).
This function must follow the rule: if the search string is an array, it will return an array. If the search string is an array, it will find and replace each element in the array. If an array needs to be found and replaced at the same time, and the number of elements that need to be replaced is less than the number of elements found, the extra elements will be replaced with an empty string. If you are looking for an array, but only one string is replaced, the alternative string will have an effect on all found values.
2. The is_numeric () function is used to detect whether a variable is a number or a numeric string.
Returns TRUE if the specified variable is a number and a numeric string, otherwise returns FALSE. Note that the floating point returns a null value, that is, FALSE
Example