PDA

View Full Version : How to Use "strip_tags" string function?



Magento
05-29-2012, 04:37 AM
How to Use "strip_tags" string function?

AllenSantiago
05-29-2012, 06:03 AM
The strip_tags() function is used to strips a string from HTML, XML, and PHP tags.
It has mainly two parameters
1) String:- specifies string to check
2) Allow:- specifies allowable tags and will not be removed
Syntax:-
strip_tags(string,allow)
Example:-
<?php
echo strip_tags("This is an example of strip tags");
?>
The output is: - This is an example of strip tags
You can get more idea at http://www.w3schools.com/php/func_string_strip_tags.asp

seoandu
06-20-2012, 11:23 PM
I think above mentioned way is best,
you have to follow this.

michaelstrom
06-29-2012, 06:43 AM
<?php
$text = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
echo strip_tags($text);
echo "\n";

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

don19
07-06-2012, 01:09 AM
http://php.net/manual/en/function.strip-tags.php

It is pretty simple and I don't think it needs any further explanation. If you still have any SPECIFIC issue, please make it clear.

satnam1980
07-23-2012, 02:18 PM
<?php
$text = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
echo strip_tags($text);
echo "\n";

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

Jessicad0505
08-24-2018, 10:42 AM
Awesome post about Liferay it's really great...