I want to replace all html codes to empty space. I think I should use preg_replace function, but I’m not sure how should I do that in case when html codes looks in this way:
”
β
$text="β something ” test..."
$text=preg_replace("&# [what should be here?] ;", " ", $text);
echo $text;
result = something test...
I think it should be only numeric, because I found only numeric ones here: http://www.ascii.cl/htmlcodes.htm
You could look at strip_tags which does exactly that. However those arent HTML codes, they are called HTML entities.
The regex to match what you want looks like this:
(&#.+?;)Its rather simple, look for the
&#then any repeated character until;.Edit: As Qtax pointed out, they dont have to be numbers. Dot matches all.