Skip to content

Add pack/unpack support for signed integers with specific endianness #17068

Open
@mvorisek

Description

@mvorisek

Description

The same way as already added to float according to the changelog https://www.php.net/manual/en/function.pack.php.

Currently code like this is needed:

$unpackToSignedIntLeFx = static function (string $v) {
    $unpacked = unpack('va/Cb/cc', $v);

    return ($unpacked['c'] << 24) | ($unpacked['b'] << 16) | $unpacked['a'];
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions