[Solved] preg_replace/string_replace symbol – or * to space


A few ways to do this.
String replace, as mentioned by Ashish.

$input  = "-**abcd1234-*---";
$output = str_replace(array('-', '*'), '', $input);
echo $output;

If you have a large number of characters to strip though, maybe this would be a little easier.

$input  = "-**abcd1234-*---";
$remove = "-*";
$output = str_replace(str_split($remove), '', $input);
echo $output;

And of course, you can use regex.

$input  = "-**abcd1234-*---";
$output = preg_replace('/[*-]/', '', $input);
echo $output;

0

solved preg_replace/string_replace symbol – or * to space