Basically it means that it will work with any sequence of bytes.
If you put control characters, "\n"
, or null character "\0"
, she won’t have any trouble making the replacement.
Example:
$str1 = 'quebra'.chr(0).'de'.chr(0).'linha';
$str2 = str_replace( chr(0), "\n", $str1 );
This works perfectly.
In PHP in general the functions are, because internally PHP associates the data to a kind of internal "variable" that stores the size.
In some languages for example, instead of the size being stored, what indicates the end of the string is the null character "\0"
(which in PHP is returned by chr(0)
), what would be an example of "no Binary safe".
Note that these are just architectural decisions, it is the task of the programmer to know the language and solve as needed. Simply if you need a string Binary safe in C, just do as PHP does internally: storing the size of the data, instead of indicating with a specific character.