Strip some basic HTML tags from String

Hey Guyz! I am going to show how you can strip some HTML tags from given string by avoiding some particular tags to strip.

And this is PHP function

strip_tags( "<YOUR_STRING_WILL_GO_HERE>", $allowable_tags )

$allowable_tags is the tags you do not want to strip. You can keep it blank to strip all tags.


Let’s see how it works.

  1. Check the below screenshot; its showing a code and output of string without using strip tag.
  2. Now let’s use strip_tags function and see the result; its plain text without any effect
  3. Now let’s say that we do not want to strip some tag say <b> and <u> and see the result

Hope this helps you to understand PHP strip_tags function!

Thank You! We will update you with more interesting things soon. 🙂

Blog Catagory : HTML / CSS , PHP