I can get it to remove all the question marks with the code below:
preg_replace('/(\?+)/', '', $string)
No matter what I seem to do I can't get it to also remove all the minus signs as well. Everything I try just breaks the whole regex.
I can get it to remove all the question marks with the code below:
preg_replace('/(\?+)/', '', $string)
No matter what I seem to do I can't get it to also remove all the minus signs as well. Everything I try just breaks the whole regex.
Maybe
str_replace(array("?", "-"), "", $string)
Will work more to your liking.
Either use a string replace, or:
preg_replace('/[-?]/', '', $string)
That will remove any question marks or dashes (minus signs) from your input. Easier to extend to more characters than string replacement, since you can simply add the new character inside the square bracket and be done.