- dechex: documentation ( source)
- pack: documentation ( source)
- strrev: documentation ( source)
- unpack: documentation ( source)
<?php
function getFloatFromInteger($integer)
{
$hex = dechex($integer);
$pack = pack('H*', $hex);
$pack = strrev($pack);
$result = unpack('d*', $pack);
return $result[1];
}
$test = getFloatFromInteger(4619191942746344941);
echo PHP_INT_MAX;