: This article mainly introduces the meaning of php binary security. if you are interested in the PHP Tutorial, please refer to it. PHP has the concept of string.
In string, the size of each Character is byte (compared with PHP, each Character in Java is Character, UTF8, and each Character in C can be selected during compilation ).
Byte contains ASCII characters, such as ABC, 123, abc, and some special characters, such as carriage return and return.
Many special characters cannot be displayed. In other words, there is no standard for their display methods. for example, if encoding 65 is A letter everywhere, encoding 97 is a character everywhere, and the backspace is displayed as A symbol in some places, in some cases, the previous character is actually removed.
PHP is based on C, so many descriptions are compared with C. A typical definition of a string in C is to end with a code 0 as the string. Assume that the three characters in a string are encoded as, 0, and 97 respectively. If the str_replace function in C is used to replace 97 with 98, then when this function is read to 0, it is deemed to have ended, and then it will get 98,0, 97. The str_replace in PHP is binary safe, so this 0 is not considered as a special ending symbol, so the result is 98,0, 98.
[Binary security] in the PHP document, it basically means that functions similar to functions in the C language are specially processed for some characters, while the PHP function treats all characters equally, you don't have to worry about the impact of special characters on processing, especially the encoding of 0 characters.
The above introduces the meaning of php binary security, including some content, and hopes to help friends who are interested in PHP tutorials.