Home » PHP strip_tags() Function

PHP strip_tags() Function

by Online Tutorials Library

PHP string strip_tags() Function

PHP string_tags() is predefine string function of PHP. It is used to strip HTML and PHP tags from a string or strips a string from HTML, XML and PHP tags.

Note 1: This function is binary safe. It return a string with all NULL bytes.

Note 2: HTML comment and PHP tags are also striped. It is hardcoded and can be changed with allowable_tags.

Syntax:

Parameter Description Required/Optional
String Specify the string to check required
Allow Specify allowable tags. Optional

Example 1

Output:

Hello PHP!  

Note 1: The strip_tags() function is strips a string from HTML, XML, and PHP tags. In this example, the <b> tag gets stripped.

Example 2

Output:

Hello TutorAspire!  

Example 3

Output:

Test paragraph. TutorAspire Test paragraph. TutorAspire 

References:

http://www.php.net/manual/en/function.strip-tags.php

Next TopicPHP String

You may also like