I want to remove all tags except the img tag,
$words = strip_tags($words, '<img>');
Is it useful?
Yes, to remove tags.
But strip_tags() won't help against the most dangerous thing - an XSS. You will need some regular expression, or use http://htmlpurifier.org/ to be sure there are no unwanted parameters in the <img> tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With