Str_replace for multiple items

Like this:

str_replace(array(':', '\\', "https://stackoverflow.com/", '*'), ' ', $string);

Or, in modern PHP (anything from 5.4 onwards), the slighty less wordy:

str_replace([':', '\\', "https://stackoverflow.com/", '*'], ' ', $string);

Leave a Comment