Monday 29 September 2014

strip_tags in PHP

PHP strip_tags() function is utilized to strips out all HTML, PHP and XML tags from given string. It also strip out all HTML comments.

Syntax:

strip_tags(string,allow)
string : Required. Specifies the input string

allow : Optional. Specifies the tags which will not be evacuated

Note: This function is binary-safe.

Example:

<?php
echo strip_tags("Good <b>Morning</b>");
echo "<br /><strong>Example using allow parameter : </strong><br />";
echo strip_tags("Good <b><i>Morning</i></b>","<b>");
?>
Output will be:
Good Morning
Example using allow parameter : 
Good Morning 

0 comments:

Post a Comment