3v4l.org

run code in 500+ PHP versions simultaneously
<?php /* * Fill in all four below and click the blue 'eval();' button. * ------------------ */ $server_seed = ""; $client_seed = ""; $game_id = ""; $mine_count = 3; /* ------------------ */ if ($server_seed == '' || $client_seed === "" || $game_id == '') { echo "Fill in details"; return; } $grid_size = 25; // Same hex-to-decimal-via-bcmath approach as the other games, reused per shuffle step. function hmac_mod($server_seed, $message, $modulus) { $hmac_hash = hash_hmac('sha256', $message, $server_seed); $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])); } return (int) bcmod($decimal_value, (string) $modulus); } // Fisher-Yates shuffle over all 25 tiles — one HMAC draw per swap, identical // to get_mines_positions() server-side. Message per step i is // "{client_seed}-{game_id}-{i}", modulus is i+1. $positions = range(0, $grid_size - 1); for ($i = $grid_size - 1; $i > 0; $i--) { $message = $client_seed . "-" . $game_id . "-" . $i; $r = hmac_mod($server_seed, $message, $i + 1); $tmp = $positions[$i]; $positions[$i] = $positions[$r]; $positions[$r] = $tmp; } $mine_positions = array_slice($positions, 0, $mine_count); sort($mine_positions); echo "Mine positions: " . implode(", ", $mine_positions); ?>

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.69
8.5.80.0120.00716.68
8.5.70.0360.00516.59
8.5.60.0310.01016.65
8.5.50.0380.00516.24
8.5.40.0320.00816.21
8.5.30.0080.01016.50
8.5.20.0350.00716.39
8.5.10.0300.01116.73
8.5.00.0150.00916.71
8.4.240.0100.01119.45
8.4.230.0220.00619.05
8.4.220.0240.00819.14
8.4.210.0170.00319.28
8.4.200.0150.00519.60
8.4.190.0170.00519.25
8.4.180.0060.00619.74
8.4.170.0320.00819.32
8.4.160.0300.01419.54
8.4.150.0360.01019.42
8.4.140.0330.00917.37
8.4.130.0330.00817.40
8.4.120.0330.00717.74
8.4.110.0290.00617.64
8.4.100.0160.00417.86
8.4.90.0360.01017.61
8.4.80.0360.01017.70
8.4.70.0320.01217.77
8.4.60.0300.01317.79
8.4.50.0330.01117.55
8.4.40.0370.00917.49
8.4.30.0340.00817.53
8.4.20.0360.00817.47
8.4.10.0390.00517.54
8.3.320.0430.00518.34
8.3.310.0280.01318.46
8.3.300.0360.00718.31
8.3.290.0330.00818.30
8.3.280.0270.00818.07
8.3.270.0350.00516.67
8.3.260.0170.00816.34
8.3.250.0170.00616.39
8.3.240.0260.00216.40
8.3.230.0160.00616.57
8.3.220.0150.00616.61
8.3.210.0140.00516.61
8.3.200.0130.00716.32
8.3.190.0160.00316.65
8.3.180.0140.00516.66
8.3.170.0150.00516.68
8.3.160.0350.00416.32
8.3.150.0280.00816.46
8.3.140.0200.00416.50
8.3.130.0160.00416.72
8.3.120.0130.00416.59
8.3.110.0270.00816.76
8.3.100.0220.00516.73
8.3.90.0140.00616.65
8.3.80.0160.00516.61
8.3.70.0190.01016.52
8.3.60.0370.00516.63
8.3.50.0180.00416.39
8.3.40.0170.00417.59
8.3.30.0150.00117.91
8.3.20.0100.00517.83
8.3.10.0190.00317.57
8.3.00.0300.00417.78
8.2.320.0360.01117.78
8.2.310.0340.00617.86

preferences:
30.75 ms | 761 KiB | 5 Q