How to use strip tags in PHP

In this article I will explain how strip tags function used in PHP.
  • 1444

strip_tags() Function

This function strips a string from HTML, XML, and PHP tags.It mean it used some special tag which can not be changed or removed with the allow parameter.

Syntax

strip_tags(string,allow)

 

 Parameter  Description
 string  Required. Specifies the string to check
 allow  Optional. Specifies allowable tags.

Example

<html>
<body>
<?php
echo strip_tags("Nitin <b>Bhardwaj!</b>");
?>
<br />
<?php
echo strip_tags("Sachin <b><i>Bhardwaj!</i></b>","<b>");
?>
</html>
</body>

Output

strip-tags-php.jpg

You may also want to read these related articles Click here

Ask Your Question

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.