Strip_tags Definitions and usage
The Strip_tags () function strips out the HTML, XML, and PHP tags in the string.
Note: This function always strips HTML comments. This cannot be changed by allow parameters.
Note: This function is binary safe.
Grammar
Strip_tags (String,allow)
Parameters |
Description |
String |
Necessary. Specify the string to check. |
Allow |
Optional. Specify the allowed label. These labels will not be deleted. |
Technical details
return value: |
Returns the stripped string. |
PHP version: |
4 + |
Update log: |
The function is binary safe since PHP 5.0. This function always strips HTML comments from PHP 4.3. |
Strip_tags Instance 1,
Strip out the HTML tags in the string:
<?php
Echo strip_tags ("Hello <b>world!</b>");
? >
Results
Hello world! 、
Example 2
Strip the HTML tags in the string but allow <b> tags to be used:
<?php
Echo strip_tags ("Hello <b><i>world!</i></b>", "<b>");
? >
Results
Hello world!