use of strip_tags

by kalai 2008-03-15 19:57:04

The strip_tags() function strips a string from HTML, XML, and PHP tags.

Syntax

strip_tags(string,allow)

This function tries to return a string with all HTML and PHP tags stripped from a given str. You can use the optional second parameter to specify tags which should not be stripped.

<?php
$text = '<p>Test paragraph.</p><!-- Comment --> echo strip_tags($text);
echo "
";

// Allow <p> and
echo strip_tags($text, '<p> ?>

The above example will output:

//result of strip tags
Test paragraph. Other text

// result of strip tags with allow html elements.
<p>Test paragraph.</p>


1839
like
0
dislike
0
mail
flag

You must LOGIN to add comments