3v4l.org

run code in 500+ PHP versions simultaneously
<?php /* * Fill in all three below and click the blue 'eval();' button. * ------------------ */ $server_seed = ""; $client_seed = ""; $game_id = ""; /* ------------------ */ if ($server_seed == '' || $client_seed === "" || $game_id == '') { echo "Fill in details"; return; } // Create HMAC-SHA256 hash $message = $client_seed . "-" . $game_id; $hmac_hash = hash_hmac('sha256', $message, $server_seed); // Convert hex to decimal using bcmath for large numbers $decimal_value = '0'; $length = strlen($hmac_hash); for ($i = 0; $i < $length; $i++) { $decimal_value = bcmul($decimal_value, '16'); $decimal_value = bcadd($decimal_value, hexdec($hmac_hash[$i])); } // Apply modulo 10^8 $roll = (int) bcmod($decimal_value, '100000000'); // Same "inverse odds" transform as crash_point_from_roll() server-side — // house edge 0.07, floored to the nearest cent, floor of 1.00x. $house_edge = 0.07; $r = $roll / 100000000; $raw = (1 - $house_edge) / (1 - $r); $crash_point = max(1.0, floor($raw * 100) / 100); echo "Roll: " . $roll . "\n"; echo "Crash point: " . number_format($crash_point, 2) . "x"; ?>
Output for 8.2.31 - 8.2.32, 8.3.0 - 8.3.33, 8.4.1 - 8.4.24, 8.5.0 - 8.5.9
Fill in details

preferences:
49.63 ms | 765 KiB | 4 Q