I'm writing to request for RFC karma.
Here is what I am doing and why doing this.
The pack/unpack's parameter 'd' and 'f' are machine order in PHP.
The number 236.0 packed to 'd' is: 0000000000806d40.
I was reversing a game save file, which uses 406D800000000000.
Here is how I decode that in PHP.
public function readDouble()
$data = substr($this->stream, $this->ptr, 8);
$this->ptr += 8;
$data = implode('', array_reverse(str_split($data, 1)));
$int = unpack('d', $data);
return (double) ($int);
Since integers are allowed to pack/unpack in both little endian and
big endian, I think double/float also need.
In this PR, I choose:
e: little endian double
E: big endian double
g: little endian float
G: big endian float.
BTW, these formats, 'e', 'E', 'g', and 'G' are not taken in Perl.
I've created a PR: https://github.com/php/php-src/pull/1905