3v4l.org

run code in 500+ PHP versions simultaneously
<?php /* * Fill in all below and click the blue 'eval();' button. * ------------------ */ $server_seed = ""; $client_seed = ""; $game_id = ""; $chance = 0.50; // your chosen chance, e.g. 0.50 for 50% $direction = "under"; // "under" or "over" /* ------------------ */ 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 threshold/win check as upgrade_start_game() server-side — // house edge 0.10, symmetric under/over. $house_edge = 0.10; $multiplier = (1 - $house_edge) / $chance; $threshold = (int) ($chance * 100000000); $win = $direction !== "over" ? $roll < $threshold : $roll >= (100000000 - $threshold); echo "Roll: " . $roll . "\n"; echo $win ? ("Win \xe2\x80\x94 payout " . number_format($multiplier, 4) . "x") : "Loss"; ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.90.0030.00416.78
8.5.80.0070.01016.67
8.5.70.0330.00816.74
8.5.60.0320.00716.59
8.5.50.0310.01016.64
8.5.40.0370.01016.29
8.5.30.0410.00716.34
8.5.20.0350.00816.57
8.5.10.0370.00416.20
8.5.00.0090.01016.74
8.4.240.0120.00919.34
8.4.230.0330.01319.04
8.4.220.0190.00619.13
8.4.210.0190.00619.22
8.4.200.0120.00719.50
8.4.190.0130.00719.36
8.4.180.0120.00719.57
8.4.170.0120.00719.68
8.4.160.0150.00419.71
8.4.150.0210.00619.57
8.4.140.0340.01117.41
8.4.130.0340.00917.46
8.4.120.0360.01417.51
8.4.110.0370.01017.73
8.4.100.0350.00817.66
8.4.90.0370.00917.58
8.4.80.0400.00817.81
8.4.70.0340.01117.72
8.4.60.0310.01117.81
8.4.50.0350.00417.81
8.4.40.0350.00917.50
8.4.30.0390.00917.40
8.4.20.0320.01217.75
8.4.10.0370.01017.75
8.3.320.0380.00918.34
8.3.310.0310.00818.41
8.3.300.0290.00818.25
8.3.290.0310.00818.43
8.3.280.0250.00718.53
8.3.270.0280.00616.38
8.3.260.0270.00816.67
8.3.250.0260.00716.73
8.3.240.0300.00716.66
8.3.230.0320.00816.39
8.3.220.0310.01216.61
8.3.210.0350.00916.63
8.3.200.0350.00816.55
8.3.190.0330.01016.67
8.3.180.0300.00516.64
8.3.170.0170.00416.59
8.3.160.0160.00416.67
8.3.150.0360.00816.61
8.3.140.0310.00916.50
8.3.130.0320.00716.53
8.3.120.0300.00716.67
8.3.110.0330.00716.89
8.3.100.0310.00716.50
8.3.90.0230.00416.59
8.3.80.0350.00716.39
8.3.70.0330.00616.73
8.3.60.0170.00416.67
8.3.50.0270.00816.54
8.3.40.0410.00717.72
8.3.30.0270.00617.67
8.3.20.0250.01017.84
8.3.10.0260.00617.91
8.3.00.0320.00417.83
8.2.320.0460.00817.80
8.2.310.0350.00618.10

preferences:
43.38 ms | 761 KiB | 5 Q