PHP converting/encoding to 7bit binary string

111 Views Asked by At
1. "20220924020521"
2. 20220924020521
3. 0x12640CFE4729
4.        00010010      01100100     00001100    11111110   01000111  00101001
5. 000100       1001100      1000000     1100111    1111001   0001110  0101001
6. 0x044C4067790E29
7. Binary string of (6)

I need to convert a string from (1) to (7) in PHP, let me explain.

(1) is converted to an long integer(2) and then to its hex equivalent(3) but it is encoded in 8 bits(4). I need to then encode it to 7 bits(5) and then back to a binary string(7).

Is there a built-in function to convert from 1 to 7 in PHP?

This isn't homework, I'm trying to convert a date for the FAST protocol of FIX.

My question is about whether there is a low code way to do this.

Thank you.

0

There are 0 best solutions below