- 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) . chr(255) . ' ', 3);
echo (string) unpack('d', "7fef ffff ffff ffff")[1], PHP_EOL;