How do I check whether a bit is 1 or 0 in PHP?
I need to loop through a large file and check each bit, whether it is 1 or 0 and put this into a multi-dimentional array based on a set “column length”.
Something like:
$binary = 0100110110110001100010001111101100111;
$binary=binaryToArray($binary,10);
And the result would look like:
array[0][0]=0; array[0][1]=1; array[0][2]=0; //etc.
array[1][0]=1; array[1][1]=1; array[1][2]=0; //etc.
You can write a class that wraps the data and returns an instance of another class that wraps the byte:
(untested)
You can also return a string directly from
DataBitAccessor