If you find that you have a string containing commas and need to remove them, you can do the following. This comes up a lot when you are cleaning up CSV values, normalizing phone numbers, or turning a list of IDs into a format that can be used in a database query or API call. In this quick PHP example, we will use the built-in str_replace() function to strip commas from a string so you end up with clean, predictable data to work with in the rest of your code.
Let’s assume your string looks like this.
$myString = "1,5,6,11,18";Now let’s strip those ugly commas from our variable $myString using the str_replace() function.
$newString = str_replace( ',', '', $myString );That’s it, enjoy!








Nice post. it is very useful for us. thank you for sharing useful information.
keep post.