- str_repeat: documentation ( source)
- unpack: documentation ( source)
<?php
// 7f ef ff ff ff ff ff ff (Max double)
// https://en.wikipedia.org/wiki/Double-precision_floating-point_format#Double-precision_examples
// 7f = 127
// ef = 239
// ff = 255
$str = chr(127) . chr(239) . str_repeat(chr(255), 6);
echo $str;
echo (string) unpack('d', $str)[1], PHP_EOL;