Fandom

PHP Wiki

strip_tags

51pages on
this wiki
Add New Page
Talk0 Share


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

<?php
 $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

htmlspecialchars

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

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.