在PHP中,函数是二进制安全的意味着什么? [英] In PHP what does it mean by a function being binary-safe?
问题描述
在PHP
中, binary-safe
是什么功能?
In PHP
what does it mean by a function being binary-safe
?
是什么使它们与众不同以及通常在哪里使用?
What makes them special and where are they typically used ?
推荐答案
这意味着当您向函数传递任意二进制数据(即包含非ASCII字节和/或空字节的字符串)时,该函数将正常工作.
It means the function will work correctly when you pass it arbitrary binary data (i.e. strings containing non-ASCII bytes and/or null bytes).
例如,非二进制安全函数可能基于C函数,该函数需要以null结尾的字符串,因此,如果字符串包含null字符,该函数将忽略其后的任何内容.
For example, a non-binary-safe function might be based on a C function which expects null-terminated strings, so if the string contains a null character, the function would ignore anything after it.
这很重要,因为PHP不会干净地分隔字符串和二进制数据.
This is relevant because PHP does not cleanly separate string and binary data.
这篇关于在PHP中,函数是二进制安全的意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!