An easy way is to use strip_tags , but it is not very reliable. There is a very, very, VERY good project for this: HTML Cleaner .
He is smitten, tested and very good. strip_tags is a simple, fast and fast way, but it may skip some kind of incorrect HTML code that the browser will parse and execute.
Please do not use regex to parse html!
source share