[Solved] How can I use an array in str_replace() function?


You can do that by passing an array as first argument:

$res = str_replace(array(' ', '-', ','), '', $str);

You can test it here at phpfiddle.org.

str_replace() PHP’s function let you choose if the three
parameters will be a single value or an array.

0

solved How can I use an array in str_replace() function?