Remove HTML tags using PHP Script

I want to strip all HTML tags from string using PHP. After doing some googling, this is the best way i found.

strip_tags(preg_replace("/<([a-z][a-z0-9]*)[^>]*?(\/?)>/i",'<$1$2>', $HTMl_TEXT))

Just put the HTML Text Variable, and you’re done. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.