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.
Like this:
str_replace(array(':', '\\', '/', '*'), ' ', $string);
Or, in modern PHP (anything from 5.4 onwards), the slighty less wordy:
str_replace([':', '\\', '/', '*'], ' ', $string);