Meaning of PHP binary security

Source: Internet
Author: User

In PHP, there is the concept of string.
In string, the size of each character is byte (compared to PHP, each character in Java is character, which is the UTF8 character, and each character in the C language can be selected at compile time).
In byte, there are ASCII code characters, such as ABC,123,ABC, and some special characters, such as carriage return, backspace, and so on.
Many of the special characters are not displayed. Or, they do not display the standard, for example, code 65 to where the letter A, code 97 to where the character a, backspace in some places to display a symbol, in some places will really return the previous character.
PHP is based on C, so many of the descriptions are in the C comparison. In the C string, a classic definition is to encode 0 as the end of a string. So, suppose such a string, where the 3-character encoding is 97,0,97. So, if there is str_replace equivalent function in C, use it to change 97 to 98, then this function reads to 0, it is considered to be finished, it will get 98,0,97. corresponding to it, PHP str_replace is binary security, then the 0 will not be considered a special end symbol, so the result is 98,0,98.
"Binary security" in the PHP document, basically is the meaning of: C language functions similar to the function will be special processing of some characters, and PHP this function for all characters equal, do not worry about special characters affect processing, especially do not worry about encoding 0 characters.

Binary security functions:

Example: DirName

Meaning of PHP binary security

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.