Hello Readers if you want to convert your string into binary using PHP then you can use the code syntax as below:-
$value = unpack('H*', "This string is converting into binary");
echo base_convert($value[1], 16, 2);
Output:-
0101001101110100011000010110001101101011
and you again want to convert binary to string then you just have to user pack syntax
Now this syntax will go like this:-
echo pack('H*', base_convert('0101001101110100011000010110001101101011', 2, 16));
Output:-
This string is converting into binary
1 Comment(s)