Reputation: 31
How to wipe html special chars like
and others from text with the help of PHP?
Upvotes: 3
Views: 5309
Reputation: 382706
.....
$newtext = html_entity_decode($your_text);
You got to remove
separately:
$newtext = str_replace(' ', '', $newtext);
If you want to remove html tags
too, you can use:
$newtext = strip_tags($newtext);
.......
Relevant Functions Reference:
Upvotes: 9
Reputation: 401012
You might want to try with html_entity_decode
;-)
For example :
$html = "this is a text";
var_dump($html);
var_dump(html_entity_decode($html, ENT_COMPAT, 'UTF-8'));
Will give you :
string 'this is a text' (length=19)
string 'this is a text' (length=15)
Upvotes: 4