PHP Removal HTML markup--strip_tags and htmlspecialchars the difference _php tutorial

Source: Internet
Author: User
Strip_tags
Remove the HTML and PHP tags.
Syntax: string strip_tags (String str);
return value: String
Function type: Data processing
Content Description
This function removes any HTML and PHP tag strings contained in the string. If the string of HTML and PHP tags are wrong, for example, less than the symbol, it will also return errors. The function and FGETSS () have the same functions.

Htmlspecialchars
Converts special characters to HTML format.
Syntax: String htmlspecialchars (String string);
return value: String
Function type: Data processing
This function converts special characters to HTML string format (&....;). The most commonly used occasion may be to deal with the message of the customer message version.
& (and) turn into &
"(double quotation marks) to turn"
< (less than) turn into <
> (greater than) turn into >
"(single quote) turn into '
This function converts only the above special characters, and does not convert all of the ASCII conversions that are determined by the HTML.
Copy CodeThe code is as follows:
$new = Htmlspecialchars ("Test", ent_quotes);
Echo $new;
?>

Result: Test

http://www.bkjia.com/PHPjc/327899.html www.bkjia.com true http://www.bkjia.com/PHPjc/327899.html techarticle Strip_tags removes HTML and PHP markup. Syntax: string strip_tags (String str); Return value: String function type: Data processing content Description This function can remove any of the characters contained in the string ...

  • 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.