strip_tags
from PHPWiki - the free guide to PHP.
[edit] Description
strip_tags returns an 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.
[edit] Parameters
| string strip_tags (string input [, string allowable_tags]) |
[edit] Parameter Infos
| 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 |
[edit] Examples
[edit] Example 1:
<?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); ?>
[edit] Output
I am a link I like PHP ;)
[edit] See also
- For more details on this function, visit its entry in the php manual.
