strip_tags
Remove HTML and PHP tags from string
strip_tags()
function strips HTML, XML, and PHP tags from strings.
Comment: This function always strips HTML comments. This cannot be changed by the allow parameter.
Note: This function is binary safe.
Strip HTML tags from strings:
<?php echo strip_tags ( "Hello <b>world!</b>" ) ; ?>
Try it yourself
Strip the HTML tags from the string, but allow the <b> tags:
<?php echo strip_tags ( "Hello <b><i>world!</i></b>" , "<b>" ) ; ?>
Try it yourself
strip_tags ( < i > string , allow )
parameter | describe |
---|---|
string | Required. Specifies the string to be checked. |
allow | Optional. Specifies permitted labels. These tags will not be deleted. |