How to Use "strip_tags" string function?
How to Use "strip_tags" string function?
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
Last edited by AllenSantiago; 09-12-2012 at 05:20 AM.
I think above mentioned way is best,
you have to follow this.
<?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>');
?>
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.
ECVPS - High Quality service, Free port monitor , Fully Managed Service
Website : http://www.ecvps.com || VPS Hosting, 24/7 Ticket Support & Live Chat
Call Us : +852 3485 0037
<?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>');
?>
Awesome post about Liferay it's really great...
|
Bookmarks