views:

247

answers:

1

I have binary basically, say it's 300 in length. How would I split (much like using explode) it into 8 bit chunks? I look at chunk_split() but it only seems to have an 'end' parameter, not an option to put it into an array.. Or can it be socketed into an array?

The end 8 digits can be below 8 (in case a miscopy from someone, and it's 4) so no validation is needed, just consistantly in 8 number chunks from the start to end.

+4  A: 

str_split:

$chunks = str_split($data, 8);
strager
Thanks, wasn't sure it could be done this way, saves me a lot of time! +1
oni-kun