I remember doing this before, but can't find the code. I use str_replace to replace one character like this: str_replace(':', ' ', $string); but I want to replace all the following characters /:*?"<>|, without doing a str_replace for each.
str_replace(':', ' ', $string);
/:*?"<>|
Like this:
str_replace(array(':', '\', '/', '*'), ' ', $string);
Or, in modern PHP (anything from 5.4 onwards), the slighty less wordy:
str_replace([':', '\', '/', '*'], ' ', $string);
1.4m articles
1.4m replys
5 comments
56.9k users