B
B
banny_name2015-10-19 21:56:48
PHP
banny_name, 2015-10-19 21:56:48

How to properly pack/unpack data to/from a binary string (pack/unpack)?

I watched examples of use, understood almost nothing, could you (who used and knows or just understood what and how)
explain to me what and how?
and I can't understand anything.
How to properly pack an array/strings
and unpack?
I do something like this:

$str    = base_convert('banny_boom', 16, 2); //101110101011
$pack   = pack('C*',$str); //�
$unpack = unpack('Cstring', $ver);//int(255)

here is a var_dump of all this *:
string(12) "101110101011"
string(1) "�"
array(1) {
  ["string"]=>
  int(255)
}

Please tell me what is the right way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2015-10-19
@dimonchik2013


two times
and parse the real one, for example https://github.com/dostelon/TabGeo-php/blob/master...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question