How do I use htmlspecialchars to escape all html but then allow two tags?

I've escaped my text but want to allow the following two tags:
img
iframe

Is there an easy way to do this?
I never had a class on php so everything I know is self taught.

Any insight would be greatly apreciated :)

Thanks in advance guys!

Member Avatar for diafol

Try strip_tags()? It has a different effect to 'htmlse' but you can apply exceptions/allowed tags.

commented: Thanks that worked :) +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.