tags:

views:

529

answers:

2

i want to remove all tags except img tag

$words = strip_tags($words, '<img>');

is it useful ?

+5  A: 
strip_tags($words, '<img>');

Take a look at the php manual.

Danten
it was poor formatting, not the stupid code in the question :)
Col. Shrapnel
+7  A: 

Yes, to remove tags.
But strip_tags() won't help against most dangerous thing - an XSS. You will need some regexp, or use http://htmlpurifier.org/ to be sure there are no unwanted parameters in the <omg> tag

Col. Shrapnel
+1 for `<OMG>` tag
Henri Watson
+1 for XSS warning.
BalusC
ooops, hehe funny typo :) good tag, let's leave it as is :)
Col. Shrapnel
I think this is the first useful typo I have ever seen. +1 for being thorough with unintentional humor. The <ponies /> will ride.
Tim Post
how can i use htmlpurifier ?
manhag