strip_tags()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

strip_tags()

Post by evilmonkey »

Hello,

I was wondering about the strip_tags() command in PHP. It seems to strip absolutely everything that begins with a <. For example:
<bob> - gone
<bob - gone
what's up> -stays (common typo btw)

Is there any way for it to strip only HTML tags, as opposed to random stuff like <bob>?

Thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

As you noticed, strip_tags() strips anything that may be a tag, it doesn't consider HTML vs XML vs XYZ.

viewtopic.php?t=45984
Post Reply