On the problem of PHP function stripslashes for continuous multiple backslash processing

Source: Internet
Author: User
Tags function prototype
PHP functions: Stripslashes ()

Remove the backslash, function prototype string stripslashes (String $str), return a string after escaping the backslash (\ ' convert to ', etc.).

In the official PHP Web site, it is mentioned to return a string after removing the escape backslash (\ ' convert to ', etc.). The double backslash (\ \) is converted to a single backslash (\), which is actually inaccurate, and I should test for the following result:

In the case of multiple consecutive backslashes, escaping with it does not guarantee that there will be no backslash in the returned character, for example, a return is preserved with three consecutive backslashes. , after testing, the rule for this function to remove the backslash is: two consecutive and two are all removed, more than two are subtracted 2 divided by 4, into a method of rounding, such as 7 successive backslashes after it is processed: ceil ((7-2)/4) = 2, So in practical use, more than 3 consecutive backslashes can be replaced with 3 re-use this function. Note that this issue is not mentioned on the PHP official website.

This blog original, reproduced please specify the source: http://blog.csdn.net/u011474028

The above describes the PHP function stripslashes on successive anti-slash processing problems, including aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    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.