Note the details when using the phpstrip_tags () function.

Source: Internet
Author: User
Tags string tags
The phpstrip_tags () function removes HTML, XML, and PHP tags from strings and returns the strings after the tags are removed. However, you need to pay attention to the details when using the phpstrip_tags () function, when phpstrip_tags () function is used, if the HTML tag is incomplete or damaged, more data will be deleted. This article will introduce the consequences of using the strip_tags () function to remove incomplete HTML tags. Let's take a look. The php strip_tags () function removes HTML, XML, and PHP tags from strings and returns the strings after the tags are removed. However, you need to pay attention to the details when using the php strip_tags () function, when the php strip_tags () function is used, if the HTML tag is incomplete or damaged, more data will be deleted. This article will introduce the consequences of using the strip_tags () function to remove incomplete HTML tags. Let's take a look.

The following example shows the code:

 string

string-1 hello

string-2

";$tags=strip_tags($name,'

');echo $tags;?>

Use strip_tags ($ name ,'

') Filter. we may expect the following results:

What is the cause? You carefully observe the variable $ name in the above code and find that a tag in the $ name string is incomplete because the strip_tags () function cannot actually verify the integrity of the HTML tag, if the HTML tag is incomplete, more data will be deleted. Therefore, you must pay attention to this when using the php strip_tags () function.

[Recommended related articles]

Detailed description of the strip_tags () function example for removing string tags from php

Use the php strip_tags () function to keep multiple HTML tag instances

The above is a detailed description that requires attention when using the php strip_tags () function. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.