Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个大的二进制数作为字符串存储在变量中。像这样的东西:
10111100100001010101010101010100000111111111001010101...
我想将它分成 8 个块,所以我使用它:chunk_split($text, 8);但是 chunk_split() 返回一个字符串。
chunk_split($text, 8);
如何将所有块存储在数组中?
如果您希望将 8 位存储为数组中的字符串,请使用:
str_split($text, 8);
或者,位本身可以分块为一组数组:
array_chunk(str_split($str), 8);