If you find that you have a string that contains commas and you need to remove them you can do the following.
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!