strip_tags Function in PHP

What is strip_tags Function?

Explanation

The "strip_tags" function is used to strip HTML and PHP tags from a string.

Syntax:


strip_tags(string,allow)

In the above syntax "string" with HTML,PHP tags from which to strip strings, "allow" specifies the allowable tags that need not be stripped.

Example :


<?php
echo strip_tags("Hi <b><i>Folks!</i></b>","<b>");
?>
Result :

Hi Folks!

In the above example the "<b>" is given as the allowable tag, where as "<i>""</i>" tags are stripped.

PHP Topics


Ask Questions

Ask Question