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:

ParameterDescriptionRequired/Optional
StringSpecify the string to checkrequired
AllowSpecify 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 Javatpoint!

Example 3

Output:

Test paragraph. Javatpoint 
Test paragraph.
Javatpoint

References:

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


Next TopicPHP String




Latest Courses