3v4l.org

run code in 500+ PHP versions simultaneously
<?php $max = 2 ** 31 - 1; $prime = 2123809381; $inverse = 59260789; $xor = 1163945558; $value = 3802099463828355; $encoded = ((int) ($value * $prime) & $max) ^ $xor; echo $encoded; echo (($value * $prime) & $max) ^ $xor; echo (int) (($value ^ $xor) * $inverse) & $max; echo (($value ^ $xor) * $inverse) & $max;
Output for 8.5.0 - 8.5.9
Warning: The float 8.07493450877373E+24 is not representable as an int, cast occurred in /in/P1Js3 on line 10 90203734 Warning: The float 8.07493450877373E+24 is not representable as an int, cast occurred in /in/P1Js3 on line 13 90203734 Warning: The float 2.253153530625348E+23 is not representable as an int, cast occurred in /in/P1Js3 on line 15 1543503872 Warning: The float 2.253153530625348E+23 is not representable as an int, cast occurred in /in/P1Js3 on line 17 1543503872
Output for 8.1.28 - 8.1.34, 8.2.16 - 8.2.32, 8.3.3 - 8.3.33, 8.4.1 - 8.4.24
90203734 Deprecated: Implicit conversion from float 8.07493450877373E+24 to int loses precision in /in/P1Js3 on line 13 902037341543503872 Deprecated: Implicit conversion from float 2.253153530625348E+23 to int loses precision in /in/P1Js3 on line 17 1543503872

preferences:
84.08 ms | 855 KiB | 4 Q