hanshenrik
hanshenrik

Reputation: 21513

php, how to pack int to signed 64bit little-endian string?

Strangely seems pack() doesn't support *signed* 64bit little-endian, while it support unsigned, so how do I pack a signed one?

For reference, if I want an unsigned 64bit little-endian pack(), i would simply do

    $packed = pack("P", $i);

Upvotes: 2

Views: 226

Answers (1)

Lessmore
Lessmore

Reputation: 1091

From php official docs pack

Note that the distinction between signed and unsigned values only affects the function unpack(), where as function pack() gives the same result for signed and unsigned format codes.

Upvotes: 1

Related Questions