Phper interest in learning C entry - Why php manual says that often a string function is binary safe

Primer

Why php manual often say that a function is binary safe? We usually use a function, they also did not find any difference between you, then the binary security in the end what does it mean?

Php experiment

<?php
echo strlen("abc"); // 3
echo strlen("abc\0"); // 4
echo strlen("abc\0d"); // 5
echo strlen("abc\0def"); // 7

As can be seen from the above rule \0is considered to be a character, in fact, in the above formulas \0is a asciicharacter.

Brief Description of the makeup ascii code

As we know, internal computer, all the information is ultimately a binary value. Each binary digit (bit) has two states 0 and 1, and therefore eight bits can be combined the 256 states, which is called a byte (byte). That is, a total of one byte may be used to represent 256 different states, each state corresponding to a symbol

Guess you like

Origin yq.aliyun.com/articles/718144