Description Edit

strip_tags returns a string with all HTML and PHP tags removed.

Note: strip_tags does not actually validate the HTML, partial, or broken tags. This can result in removal of text or other unexcepted things.

Note: Comments get stripped since PHP 4.3.0. This is can not be changed with allowable_tags.

Parameters Edit

{{{returns}}} strip tags (string input [, string allowable_tags])

Parameter Infos Edit

Parameter PHP Version Type
strip_tags 4 or 5 returns string
input 4 or 5 string
allowable_tags 3 >=3.0.13, 4 or 5 string

Examples Edit

Example 1: Edit

 $link = '<a href="#somewhere">I am a link</a> <!-- Comment -->';
 $text = 'I <?php echo "dont"; ?> like PHP ;)';
 echo strip_tags($link);
 echo strip_tags($text);

Output Edit

I am a link
I like PHP ;)

See also Edit


For more details on this function, visit its entry in the php manual.