3v4l.org

run code in 500+ PHP versions simultaneously
<?php /* * Fill in all four below and click the blue 'eval();' button. * ------------------ */ $unhashedServerSeed = ''; $nonce = -1; $clientSeed = ''; $qty = -1; /* ------------------ */ if ($unhashedServerSeed == '' || $nonce < 0 || $clientSeed == '' || $qty <= 0) { echo "Fill in details"; return; } define('MAX_HEX_SEGMENTS', 6); define('HEX_SEGMENT_SIZE', 2); define('BASE_FOR_HEX_CONVERSION', 256); define('HASH_TYPE', 'sha256'); function calculateDecimalValue(string $preResult): float { $decimalValue = 0; for ($i = 0; $i < MAX_HEX_SEGMENTS; $i++) { $hexValue = substr($preResult, HEX_SEGMENT_SIZE * $i, HEX_SEGMENT_SIZE); $decimalValue += hexdec($hexValue) / pow(BASE_FOR_HEX_CONVERSION, $i + 1); } return $decimalValue; } function getProvablyFairResult(string $init, int $qty): array { $preResult = hash(HASH_TYPE, $init); $decimalValue = calculateDecimalValue($preResult); $result = (int) ($decimalValue * $qty) + 1; return [ 'preResult' => $preResult, 'result' => $result, ]; } $unhashedServerSeed = preg_replace( "/\r|\n/", "", $unhashedServerSeed); $clientSeed = preg_replace( "/\r|\n/", "", $clientSeed); $nrand = strlen($clientSeed); $stringToHash = "$unhashedServerSeed-$clientSeed-$nrand-$nonce"; $result = getProvablyFairResult($stringToHash, $qty); echo "Result: {$result['result']}";

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.70.0230.00716.60
8.5.60.0150.00816.50
8.5.50.0130.00416.47
8.5.40.0220.00616.45
8.5.30.0170.00617.34
8.5.20.0200.00917.03
8.5.10.0250.00916.87
8.5.00.0170.00717.20
8.4.220.0190.00819.45
8.4.210.0200.00819.43
8.4.200.0240.00419.49
8.4.190.0210.00319.35
8.4.180.0260.00920.12
8.4.170.0230.00920.57
8.4.160.0230.01020.45
8.4.150.0230.00718.60
8.4.140.0260.00717.51
8.4.130.0200.00717.54
8.4.120.0220.00719.09
8.4.110.0240.00618.46
8.4.100.0270.00717.70
8.4.90.0240.00818.27
8.4.80.0260.00817.96
8.4.70.0270.00818.16
8.4.60.0310.00817.82
8.4.50.0280.00717.86
8.4.40.0310.00917.55
8.4.30.0310.00717.61
8.4.20.0340.00717.54
8.4.10.0340.00817.68
8.3.310.0040.00418.52
8.3.300.0220.00718.47
8.3.290.0240.00618.75
8.3.280.0230.00718.24
8.3.270.0250.00716.55
8.3.260.0270.00816.64
8.3.250.0240.00816.93
8.3.240.0260.00716.72
8.3.230.0250.00716.53
8.3.220.0260.00717.31
8.3.210.0270.00716.79
8.3.200.0260.00716.75
8.3.190.0250.00716.72
8.3.180.0220.00617.12
8.3.170.0290.00716.79
8.3.160.0290.00716.95
8.3.150.0320.00616.82
8.3.140.0320.00616.64
8.3.130.0270.00816.57
8.3.120.0300.00816.69
8.3.110.0290.00816.73
8.3.100.0310.00816.63
8.3.90.0280.00719.44
8.3.80.0320.00817.41
8.3.70.0310.00817.38
8.3.60.0330.00819.01
8.3.50.0280.00719.01
8.3.40.0300.00819.71
8.3.30.0270.00819.92
8.3.20.0240.00820.51
8.3.10.0230.00820.78
8.3.00.0180.00820.82
8.2.310.0160.00317.90
8.2.300.0270.00718.30
8.2.290.0220.00717.50
8.2.280.0240.00716.92
8.2.270.0240.00916.68
8.2.260.0260.00816.63
8.2.250.0270.00716.65
8.2.240.0270.00716.62
8.2.230.0250.00716.67
8.2.220.0260.00716.82
8.2.210.0260.00717.60
8.2.200.0260.00717.30
8.2.190.0260.00817.32
8.2.180.0270.00818.94
8.2.170.0290.00719.85
8.2.160.0260.00820.11
8.2.150.0250.00720.59
8.2.140.0240.00720.59
8.2.130.0250.00820.82
8.2.120.0250.00821.06
8.2.110.0260.00720.75
8.2.100.0250.00820.71
8.2.90.0250.00720.71
8.2.80.0260.00720.71
8.2.70.0270.00720.63
8.2.60.0250.00820.64
8.2.50.0240.00820.67
8.2.40.0240.00720.65
8.2.30.0240.00820.63
8.2.20.0230.00720.62
8.2.10.0220.00820.63
8.2.00.0240.00720.62
8.1.340.0210.00817.62
8.1.330.0190.00817.46
8.1.320.0230.00616.37
8.1.310.0240.00716.23
8.1.300.0250.00716.18
8.1.290.0270.00717.59
8.1.280.0270.00818.96
8.1.270.0240.00820.70
8.1.260.0250.00820.95
8.1.250.0240.00721.01
8.1.240.0210.00820.54
8.1.230.0230.00820.55
8.1.220.0230.00820.61
8.1.210.0220.00920.49
8.1.200.0220.00820.49
8.1.190.0230.00720.47
8.1.180.0220.00920.45
8.1.170.0240.00720.52
8.1.160.0230.00720.50
8.1.150.0240.00720.53
8.1.140.0220.00720.50
8.1.130.0220.00720.57
8.1.120.0220.00820.56
8.1.110.0220.00720.53
8.1.100.0220.00820.53
8.1.90.0230.00820.53
8.1.80.0230.00720.64
8.1.70.0210.00820.54
8.1.60.0240.00820.62
8.1.50.0240.00720.59
8.1.40.0260.00620.57
8.1.30.0240.00720.65
8.1.20.0250.00820.74
8.1.10.0250.00720.57
8.1.00.0240.00720.50
8.0.300.0250.00617.03
8.0.290.0170.01016.82
8.0.280.0240.00916.81
8.0.270.0110.00916.94
8.0.260.0210.01116.88
8.0.250.0310.00616.89
8.0.240.0190.00816.95
8.0.230.0210.00617.00
8.0.220.0190.00616.91
8.0.210.0180.00916.87
8.0.200.0150.00417.11
8.0.190.0230.01017.09
8.0.180.0280.00516.99
8.0.170.0190.00616.87
8.0.160.0200.00717.00
8.0.150.0220.01017.00
8.0.140.0240.00417.11
8.0.130.0150.00617.00
8.0.120.0260.00816.94
8.0.110.0230.00816.71
8.0.100.0260.00716.92
8.0.90.0140.00616.96
8.0.80.0270.00616.68
8.0.70.0220.01016.92
8.0.60.0230.00616.78
8.0.50.0180.00716.59
8.0.30.0240.00516.73
8.0.20.0160.00116.63
8.0.10.0140.00216.91
8.0.00.0110.00616.84
7.4.330.0150.00216.70
7.4.320.0120.00316.60
7.4.300.0130.00216.65
7.4.290.0110.00416.77
7.4.280.0120.00316.66
7.4.270.0110.00416.82
7.4.260.0120.00216.66
7.4.250.0110.00316.64
7.4.240.0110.00416.58
7.4.230.0130.00216.74
7.4.220.0100.00416.70
7.4.210.0100.00516.67
7.4.200.0120.00416.79
7.4.190.0150.00116.73
7.4.180.0190.00416.61
7.4.160.0120.00816.57
7.4.150.0190.00416.66
7.4.140.0150.00316.59
7.4.130.0080.00816.59
7.4.120.0110.00416.53
7.4.110.0110.00416.15
7.4.100.0180.00416.59
7.4.90.0180.00516.11
7.4.80.0150.00616.58
7.4.70.0120.00416.61
7.4.60.0130.00216.64
7.4.50.0100.00416.52
7.4.40.0130.00216.54
7.4.30.0100.00516.60
7.4.20.0130.00416.60
7.4.10.0120.00416.64
7.4.00.0150.00416.42
7.3.330.0120.00316.36
7.3.320.0110.00216.25
7.3.310.0150.00316.35
7.3.300.0130.00716.32
7.3.290.0150.00616.34
7.3.280.0110.00316.11
7.3.270.0180.00416.41
7.3.260.0130.00116.56
7.3.250.0110.00316.35
7.3.240.0120.00316.49
7.3.230.0130.00416.20
7.3.220.0100.00516.22
7.3.210.0090.00516.21
7.3.200.0120.00316.30
7.3.190.0110.00316.27
7.3.180.0130.00315.99
7.3.170.0100.00416.32
7.3.160.0100.00716.32
7.3.150.0120.00216.43
7.3.140.0100.00515.99
7.3.130.0140.00116.34
7.3.120.0110.00516.15
7.3.110.0100.00615.98
7.3.100.0110.00316.28
7.3.90.0090.00516.65
7.3.80.0100.00615.92
7.3.70.0100.00416.55
7.3.60.0080.00616.54
7.3.50.0120.00216.40
7.3.40.0090.00616.68
7.3.30.0080.00616.46
7.3.20.0160.00118.43
7.3.10.0140.00118.31
7.3.00.0140.00118.12
7.2.340.0100.00416.27
7.2.330.0140.00316.21
7.2.320.0100.00516.52
7.2.310.0100.00418.07
7.2.300.0110.00616.31
7.2.290.0120.00416.24
7.2.280.0100.00416.13
7.2.270.0150.00116.37
7.2.260.0120.00316.07
7.2.250.0110.00416.50
7.2.240.0090.00516.30
7.2.230.0100.00518.24
7.2.220.0140.00116.37
7.2.210.0110.00416.57
7.2.200.0110.00416.50
7.2.190.0120.00516.60
7.2.180.0100.00516.65
7.2.170.0110.00416.57
7.2.160.0100.00516.66
7.2.150.0110.00418.28
7.2.140.0140.00318.42
7.2.130.0160.00418.51
7.2.120.0210.00418.56
7.2.110.0110.00318.44
7.2.100.0100.00418.45
7.2.90.0130.00218.34
7.2.80.0090.00618.34
7.2.70.0140.00118.47
7.2.60.0090.00718.49
7.2.50.0160.00518.27
7.2.40.0160.00918.49
7.2.30.0120.00318.43
7.2.20.0120.00218.23
7.2.10.0200.00418.68
7.2.00.0130.00318.48
7.1.330.0110.00217.34
7.1.320.0210.00517.55
7.1.310.0140.00617.39
7.1.300.0240.00317.05
7.1.290.0280.00717.29
7.1.280.0180.00517.08
7.1.270.0170.00617.33
7.1.260.0200.00517.30
7.1.250.0180.00717.46
7.1.240.0190.00617.14
7.1.230.0180.00317.16
7.1.220.0140.00717.13
7.1.210.0170.00317.22
7.1.200.0100.00317.40
7.1.190.0110.00317.30
7.1.180.0090.00817.34
7.1.170.0110.00417.17
7.1.160.0120.00217.36
7.1.150.0100.00317.16
7.1.140.0090.00516.94
7.1.130.0140.00117.30
7.1.120.0120.00217.09
7.1.110.0130.00417.23
7.1.100.0110.00217.23
7.1.90.0110.00217.05
7.1.80.0110.00317.25
7.1.70.0120.00217.04
7.1.60.0120.00317.27
7.1.50.0200.00517.16
7.1.40.0140.00217.16
7.1.30.0130.00417.40
7.1.20.0090.00417.20
7.1.10.0110.00217.11
7.1.00.0110.00417.32
7.0.330.0210.00516.63
7.0.320.0120.00616.91
7.0.310.0120.00116.72
7.0.300.0090.00517.12
7.0.290.0140.00216.96
7.0.280.0160.00316.92
7.0.270.0150.00416.99
7.0.260.0190.00516.94
7.0.250.0150.00117.11
7.0.240.0150.00516.95
7.0.230.0080.00517.11
7.0.220.0120.00116.94
7.0.210.0120.00516.84
7.0.200.0100.00217.29
7.0.190.0170.00617.14
7.0.180.0160.00316.62
7.0.170.0230.00517.18
7.0.160.0150.00416.79
7.0.150.0230.00517.04
7.0.140.0180.00817.06
7.0.130.0200.00516.88
7.0.120.0160.00416.98
7.0.110.0080.00617.07
7.0.100.0130.00516.95
7.0.90.0200.00617.04
7.0.80.0140.00916.83
7.0.70.0190.00316.93
7.0.60.0150.00617.05
7.0.50.0180.00916.84
7.0.40.0110.00517.13
7.0.30.0090.00317.02
7.0.20.0160.00516.93
7.0.10.0110.00217.16
7.0.00.0170.00717.00
5.6.400.0170.00415.68
5.6.390.0100.00515.68
5.6.380.0090.00515.91
5.6.370.0100.00415.46
5.6.360.0110.00315.56
5.6.350.0160.00515.65
5.6.340.0120.00315.78
5.6.330.0130.00115.62
5.6.320.0110.00215.80
5.6.310.0160.01015.74
5.6.300.0120.00615.68
5.6.290.0200.00615.97
5.6.280.0170.00315.49
5.6.270.0100.00415.59
5.6.260.0150.00215.72
5.6.250.0220.00415.56
5.6.240.0120.00215.70
5.6.230.0150.00415.56
5.6.220.0120.00415.80
5.6.210.0110.00415.86
5.6.200.0190.00815.90
5.6.190.0200.00215.76
5.6.180.0180.00215.91
5.6.170.0110.00315.86
5.6.160.0210.00315.77
5.6.150.0210.00715.89
5.6.140.0240.00415.77
5.6.130.0200.00615.93
5.6.120.0160.00315.69
5.6.110.0120.00715.61
5.6.100.0160.00615.64
5.6.90.0140.00415.74
5.6.80.0110.00415.73
5.6.70.0160.00515.93
5.6.60.0080.00415.80
5.6.50.0080.00615.48
5.6.40.0100.00315.90
5.6.30.0090.00415.77
5.6.20.0120.00515.56
5.6.10.0080.00515.83
5.6.00.0100.00315.69
5.5.380.0130.00515.82
5.5.370.0090.00415.66
5.5.360.0150.00215.60
5.5.350.0170.00615.56
5.5.340.0190.00315.56
5.5.330.0210.00515.54
5.5.320.0130.00415.52
5.5.310.0120.00315.73
5.5.300.0180.01015.70
5.5.290.0180.00515.67
5.5.280.0110.00415.56
5.5.270.0130.00515.56
5.5.260.0240.00515.75
5.5.250.0240.00315.60
5.5.240.0200.00815.81
5.5.230.0200.00315.98
5.5.220.0150.00215.67
5.5.210.0130.00115.79
5.5.200.0080.00515.51
5.5.190.0100.00315.56
5.5.180.0110.00415.50
5.5.170.0110.00515.67
5.5.160.0160.00315.50
5.5.150.0090.00415.63
5.5.140.0160.00415.28
5.5.130.0140.00615.27
5.5.120.0110.00315.60
5.5.110.0120.00615.57
5.5.100.0090.00415.60
5.5.90.0120.00115.48
5.5.80.0140.00515.82
5.5.70.0150.00315.63
5.5.60.0140.00215.60
5.5.50.0120.00315.75
5.5.40.0120.00815.57
5.5.30.0230.00515.69
5.5.20.0200.00315.75
5.5.10.0140.00315.47
5.5.00.0110.00315.57
5.4.450.0180.00314.24
5.4.440.0080.00214.24
5.4.430.0070.00414.24
5.4.420.0120.00214.24
5.4.410.0180.00414.24
5.4.400.0070.00314.24
5.4.390.0060.00414.24
5.4.380.0180.00414.24
5.4.370.0070.00314.24
5.4.360.0090.00214.24
5.4.350.0050.00514.24
5.4.340.0070.00214.24
5.4.330.0080.00314.24
5.4.320.0090.00414.24
5.4.310.0060.00414.24
5.4.300.0060.00414.24
5.4.290.0070.00314.24
5.4.280.0100.00214.24
5.4.270.0100.00214.24
5.4.260.0090.00314.24
5.4.250.0100.00214.24
5.4.240.0070.00314.24
5.4.230.0140.00414.24
5.4.220.0140.00314.24
5.4.210.0090.00314.24
5.4.200.0110.00514.24
5.4.190.0100.00314.24
5.4.180.0080.00214.24
5.4.170.0110.00214.24
5.4.160.0100.00214.24
5.4.150.0080.00314.24
5.4.140.0080.00214.24
5.4.130.0100.00114.24
5.4.120.0070.00314.24
5.4.110.0100.00314.24
5.4.100.0060.00414.24
5.4.90.0080.00214.24
5.4.80.0090.00214.24
5.4.70.0090.00114.24
5.4.60.0060.00414.24
5.4.50.0080.00214.24
5.4.40.0060.00414.24
5.4.30.0100.00014.24
5.4.20.0070.00314.24
5.4.10.0070.00214.24
5.4.00.0070.00314.24
5.3.290.0070.00414.24
5.3.280.0080.00314.24
5.3.270.0080.00314.24
5.3.260.0070.00414.24
5.3.250.0070.00314.24
5.3.240.0080.00214.24
5.3.230.0110.00114.24
5.3.220.0100.00314.24
5.3.210.0080.00314.24
5.3.200.0070.00314.24
5.3.190.0080.00214.24
5.3.180.0090.00214.24
5.3.170.0090.00514.24
5.3.160.0080.00614.24
5.3.150.0170.00214.24
5.3.140.0130.00314.24
5.3.130.0110.00614.24
5.3.120.0160.00514.24
5.3.110.0130.00214.24
5.3.100.0080.00314.24
5.3.90.0100.00114.24
5.3.80.0080.00214.24
5.3.70.0060.00614.24
5.3.60.0100.00214.24
5.3.50.0080.00414.24
5.3.40.0130.00314.24
5.3.30.0070.00314.24
5.3.20.0110.00414.24
5.3.10.0150.00314.24
5.3.00.0120.00314.24
5.2.170.0070.00314.24
5.2.160.0080.00214.24
5.2.150.0090.00214.24
5.2.140.0100.00414.24
5.2.130.0090.00214.24
5.2.120.0060.00414.24
5.2.110.0080.00014.24
5.2.100.0060.00314.24
5.2.90.0070.00314.24
5.2.80.0100.00614.24
5.2.70.0050.00614.24
5.2.60.0100.00614.24
5.2.50.0070.00414.24
5.2.40.0090.00914.24
5.2.30.0120.00414.24
5.2.20.0170.00214.24
5.2.10.0050.00214.24
5.2.00.0060.00314.24
5.1.60.0080.00114.24
5.1.50.0060.00214.24
5.1.40.0060.00314.24
5.1.30.0070.00114.24
5.1.20.0050.00314.24
5.1.10.0050.00214.24
5.1.00.0030.00414.24
5.0.50.0050.00214.24
5.0.40.0040.00314.24
5.0.30.0070.00114.24
5.0.20.0040.00214.24
5.0.10.0060.00114.24
5.0.00.0040.00214.24
4.4.90.0040.00014.24
4.4.80.0030.00114.24
4.4.70.0030.00114.24
4.4.60.0020.00114.24
4.4.50.0040.00114.24
4.4.40.0020.00114.24
4.4.30.0030.00114.24
4.4.20.0030.00014.24
4.4.10.0040.00114.24
4.4.00.0030.00114.24
4.3.110.0030.00114.24
4.3.100.0020.00114.24
4.3.90.0040.00014.24
4.3.80.0010.00214.24
4.3.70.0010.00214.24
4.3.60.0030.00214.24
4.3.50.0030.00114.24
4.3.40.0030.00114.24
4.3.30.0020.00114.24
4.3.20.0030.00014.24
4.3.10.0030.00114.24
4.3.00.0000.00314.24

preferences:
54.59 ms | 2728 KiB | 5 Q