strip_tags definition and usage
The strip_tags() function strips HTML, XML and PHP tags from a string.
Comments: This function always strips HTML comments. This cannot be changed via the allow parameter.
Note: This function is binary safe.
Grammar
strip_tags(string,allow)
参数 | 描述 |
---|---|
string | 必需。规定要检查的字符串。 |
allow | 可选。规定允许的标签。这些标签不会被删除。 |
Technical details
Return value: | Returns the stripped string. | ||||||
PHP version: | 4 | ||||||
Update log: |
As of PHP 4.3, this function always strips HTML comments. |
strip_tags instance 1,
<?php echo strip_tags("Hello <b>world!</b>"); ?>
Strip HTML tags from a string:
Results
Hello world! ,
Example 2
<?php echo strip_tags("Hello <b><i>world!</i></b>","<b>"); ?>
Results
Hello world! PHP strip_tags() function to remove HTML, XML and PHP tags in strings, strip_tagsxml strip_tags definition and usage strip_tags () function strips HTML, XML and PHP from strings...