I am attempting to remove apostrophes from text and it isn't really working. It's got to be something small.
$text = preg_replace('/\'/', '', $text);
That's what I am using right now to remove it. What am I doing wrong?
There is a series of these to remove special characters to turn them into urls and store them in my database. However, a recent batch appeared with a ' where the ' was.
Any help is greatly appreciated. Thank you in advance.
Have a go using str_replace()
, it's quicker than preg_replace()
since it doesn't use regular expressions.
$text = str_replace("'", '', $text);