3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * Fill in all four below and click blue 'eval();' button below textarea. * * ------------------ */ $ticketPrice = -1; $unhashedServerSeed = ''; $nonce = -1; $clientSeed = ''; /* ------------------ */ if ($ticketPrice < 0 || $unhashedServerSeed == '' || $nonce < 0 || $clientSeed == '') { echo "Fill in details"; return; } function stringToInt32($seed) { $groups = str_split((string)$seed, 4); $groups = array_map(function ($g) { return unpack('C*', $g); }, $groups); $groups = array_filter($groups, function ($g) { return count($g) === 4; }); $result = array_map(function ($group) { return array_reduce($group, function ($acc, $cur) { return ($acc << 4) | $cur; }, 0); }, $groups); return array_reduce($result, function ($acc, $cur) { return ($acc ^ $cur); }, 0); } $serverSeedInt = stringToInt32($unhashedServerSeed); $clientSeedInt = stringToInt32($clientSeed); $seed = $serverSeedInt ^ $clientSeedInt ^ (int)$ticketPrice ^ (int)$nonce; $max = 10000; mt_srand($seed, MT_RAND_MT19937); $result = mt_rand(0, $max); echo "Seed: $seed\n"; echo "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.0.30.0070.00916.95
8.0.20.0060.01116.92
8.0.10.0080.01017.08
8.0.00.0120.00716.98
7.4.160.0030.01216.70
7.4.150.0110.00616.63
7.4.140.0030.01416.55
7.4.130.0070.00716.52
7.4.120.0130.00616.52
7.4.110.0090.00916.48
7.4.100.0130.00516.44
7.4.90.0120.00716.35
7.4.80.0070.01316.46
7.4.70.0090.01016.53
7.4.60.0100.00816.48
7.4.50.0070.01016.29
7.4.40.0110.00916.42
7.4.30.0040.01216.53
7.4.20.0050.01116.59
7.4.10.0100.00915.79
7.4.00.0090.01016.03
7.3.270.0120.00616.24
7.3.260.0130.00316.30
7.3.250.0130.00716.19
7.3.240.0070.01116.22
7.3.230.0070.01116.15
7.3.220.0090.00616.19
7.3.210.0080.00816.23
7.3.200.0120.00816.20
7.3.190.0110.01216.23
7.3.180.0140.00516.34
7.3.170.0080.00916.15
7.3.160.0090.01016.19
7.3.150.0120.00616.19
7.3.140.0130.00516.14
7.3.130.0060.01015.72
7.3.120.0160.00515.81
7.3.110.0090.00915.70
7.3.100.0110.00815.68
7.3.90.0100.00915.64
7.3.80.0050.00915.81
7.3.70.0080.00815.78
7.3.60.0080.00715.56
7.3.50.0070.00815.44
7.3.40.0060.00815.48
7.3.30.0060.01015.55
7.3.20.0080.00816.39
7.3.10.0150.00716.51
7.3.00.0090.00716.51
7.2.340.0060.01616.30
7.2.330.0170.00716.45
7.2.320.0140.01116.28
7.2.310.0140.01116.49
7.2.300.0150.00816.45
7.2.290.0130.01116.44
7.2.280.0130.01216.42
7.2.270.0130.01316.50
7.2.260.0120.01116.03
7.2.250.0130.00916.03
7.2.240.0170.00515.91
7.2.230.0120.01115.99
7.2.220.0200.00515.99
7.2.210.0110.01115.80
7.2.200.0110.00915.99
7.2.190.0110.00915.70
7.2.180.0130.00715.71
7.2.170.0070.01215.88
7.2.160.0090.01015.80
7.2.150.0120.00716.62
7.2.140.0100.01016.77
7.2.130.0090.00916.67
7.2.120.0150.00816.81
7.2.110.0130.00816.69
7.2.100.0100.00916.65
7.2.90.0110.00716.72
7.2.80.0090.01016.65
7.2.70.0140.00916.67
7.2.60.0090.01316.73
7.2.50.0060.01116.64
7.2.40.0140.00616.72
7.2.30.0140.00916.65
7.2.20.0070.01316.75
7.2.10.0120.00816.73
7.2.00.0110.00916.71
7.1.330.0190.00615.72
7.1.320.0210.00515.71
7.1.310.0180.00515.74
7.1.300.0120.00915.63
7.1.290.0100.01215.61
7.1.280.0120.00815.77
7.1.270.0120.01015.62
7.1.260.0130.01015.75
7.1.250.0120.00915.66
7.1.240.0150.00915.79
7.1.230.0130.01015.71
7.1.220.0130.01115.68
7.1.210.0170.00815.74
7.1.200.0240.00815.73
7.1.190.0180.01015.78
7.1.180.0180.00615.73
7.1.170.0160.00615.72
7.1.160.0130.01215.70
7.1.150.0150.01115.70
7.1.140.0170.00815.74
7.1.130.0110.01315.68
7.1.120.0140.01115.71
7.1.110.0140.01215.69
7.1.100.0180.00615.68
7.1.90.0130.01215.75
7.1.80.0130.01115.70
7.1.70.0170.00915.68
7.1.60.0220.00715.70
7.1.50.0160.00915.76
7.1.40.0150.01015.81
7.1.30.0160.00715.74
7.1.20.0170.00415.69
7.1.10.0150.00515.68
7.1.00.0140.01015.86
7.0.330.0250.01015.57
7.0.320.0180.01115.69
7.0.310.0210.01015.62
7.0.300.0180.01115.64
7.0.290.0300.01215.60
7.0.280.0210.00915.60
7.0.270.0210.00915.69
7.0.260.0200.00815.72
7.0.250.0250.00515.66
7.0.240.0200.00915.68
7.0.230.0230.01115.56
7.0.220.0200.00615.64
7.0.210.0160.00915.73
7.0.200.0210.00515.62
7.0.190.0220.00515.70
7.0.180.0150.01215.70
7.0.170.0190.00815.65
7.0.160.0360.00715.59
7.0.150.0190.00515.65
7.0.140.0150.01015.67
7.0.130.0170.01015.67
7.0.120.0170.00915.65
7.0.110.0320.00815.57
7.0.100.0160.01115.57
7.0.90.0110.01515.68
7.0.80.0190.00615.65
7.0.70.0180.00815.63
7.0.60.0220.01315.63
7.0.50.0180.00815.70
7.0.40.0180.00715.62
7.0.30.0210.00415.63
7.0.20.0200.00915.66
7.0.10.0200.00615.52
7.0.00.0150.01015.65
5.6.400.0140.01315.80
5.6.390.0190.00816.08
5.6.380.0180.01016.08
5.6.370.0150.01616.07
5.6.360.0270.00415.86
5.6.350.0160.01415.92
5.6.340.0170.01315.94
5.6.330.0190.00916.10
5.6.320.0240.00516.04
5.6.310.0220.00516.02
5.6.300.0200.00816.05
5.6.290.0120.01415.91
5.6.280.0170.00916.05
5.6.270.0200.00616.00
5.6.260.0190.00915.92
5.6.250.0170.00915.95
5.6.240.0170.00815.92
5.6.230.0190.00816.08
5.6.220.0170.01216.07
5.6.210.0210.01016.02
5.6.200.0200.00815.99
5.6.190.0170.00915.92
5.6.180.0210.00715.95
5.6.170.0200.01016.07
5.6.160.0200.00615.97
5.6.150.0190.00815.98
5.6.140.0150.01216.04
5.6.130.0160.01115.98
5.6.120.0150.01115.98
5.6.110.0200.00615.89
5.6.100.0190.01016.02
5.6.90.0160.00915.98
5.6.80.0130.01116.06
5.6.70.0180.00815.80
5.6.60.0140.01115.86
5.6.50.0150.01115.88
5.6.40.0140.01415.85
5.6.30.0190.00715.90
5.6.20.0160.01015.90
5.6.10.0200.01215.97
5.6.00.0210.00715.87
5.5.380.0110.01615.85
5.5.370.0250.00115.93
5.5.360.0180.00815.87
5.5.350.0170.01115.84
5.5.340.0130.01515.91
5.5.330.0190.00815.97
5.5.320.0130.01315.89
5.5.310.0180.01015.90
5.5.300.0170.00915.93
5.5.290.0160.01015.84
5.5.280.0190.00715.85
5.5.270.0160.00915.99
5.5.260.0150.01115.96
5.5.250.0200.00515.88
5.5.240.0150.01015.95
5.5.230.0130.01415.89
5.5.220.0240.00216.01
5.5.210.0160.01015.85
5.5.200.0190.01015.94
5.5.190.0130.01215.85
5.5.180.0210.00815.74
5.5.170.0160.01315.95
5.5.160.0110.01715.89
5.5.150.0150.01315.77
5.5.140.0170.01115.81
5.5.130.0140.01215.75
5.5.120.0150.01115.83
5.5.110.0160.01015.86
5.5.100.0130.01215.91
5.5.90.0140.01115.89
5.5.80.0180.00715.91
5.5.70.0160.01015.79
5.5.60.0170.01015.85
5.5.50.0130.01215.91
5.5.40.0210.00715.84
5.5.30.0130.01215.87
5.5.20.0170.01015.92
5.5.10.0200.00615.81
5.5.00.0110.01315.79
5.4.450.0150.00614.37
5.4.440.0130.00614.41
5.4.430.0100.01014.30
5.4.420.0150.00514.40
5.4.410.0130.00614.42
5.4.400.0080.01214.29
5.4.390.0140.00514.37
5.4.380.0130.00714.31
5.4.370.0160.00614.27
5.4.360.0170.00614.42
5.4.350.0160.00314.34
5.4.340.0090.01214.30
5.4.330.0160.00614.31
5.4.320.0150.00814.28
5.4.310.0150.00914.36
5.4.300.0180.00414.24
5.4.290.0130.00914.34
5.4.280.0100.01014.28
5.4.270.0170.00314.35
5.4.260.0170.00314.23
5.4.250.0120.00714.37
5.4.240.0130.00714.29
5.4.230.0170.00314.35
5.4.220.0140.00714.28
5.4.210.0130.00614.27
5.4.200.0120.01114.38
5.4.190.0150.00714.34
5.4.180.0160.00514.32
5.4.170.0160.00314.30
5.4.160.0120.01014.46
5.4.150.0140.00614.26
5.4.140.0120.00714.29
5.4.130.0160.00514.36
5.4.120.0160.00514.31
5.4.110.0140.00914.33
5.4.100.0150.00714.29
5.4.90.0120.01214.27
5.4.80.0180.00714.33
5.4.70.0160.00314.29
5.4.60.0180.00714.33
5.4.50.0190.00314.36
5.4.40.0140.00514.29
5.4.30.0120.00714.23
5.4.20.0100.00914.33
5.4.10.0180.00314.37
5.4.00.0140.00814.32
5.3.290.0200.00714.62
5.3.280.0130.00714.54
5.3.270.0120.00814.59
5.3.260.0080.01214.58
5.3.250.0150.00514.66
5.3.240.0170.00714.52
5.3.230.0140.00714.56
5.3.220.0120.01414.48
5.3.210.0150.00914.56
5.3.200.0180.00414.44
5.3.190.0150.00614.53
5.3.180.0150.00614.52
5.3.170.0150.00714.58
5.3.160.0150.01114.52
5.3.150.0180.00414.54
5.3.140.0120.01314.49
5.3.130.0140.00814.44
5.3.120.0170.00614.51
5.3.110.0140.00714.47
5.3.100.0130.00914.51
5.3.90.0120.01014.49
5.3.80.0160.00714.38
5.3.70.0110.01314.47
5.3.60.0150.01014.46
5.3.50.0140.00614.37
5.3.40.0120.00714.40
5.3.30.0150.00614.47
5.3.20.0130.00714.38
5.3.10.0140.01114.28
5.3.00.0140.00714.31
5.2.170.0130.00513.97
5.2.160.0110.00713.97
5.2.150.0080.00813.97
5.2.140.0120.00513.97
5.2.130.0120.00513.97
5.2.120.0110.00913.97
5.2.110.0110.00713.97
5.2.100.0100.00713.97
5.2.90.0090.00913.97
5.2.80.0060.01113.97
5.2.70.0080.00913.97
5.2.60.0130.00413.97
5.2.50.0140.00513.97
5.2.40.0100.00913.97
5.2.30.0070.00913.97
5.2.20.0100.00813.97
5.2.10.0100.00713.97
5.2.00.0100.00813.97
5.1.60.0140.00313.97
5.1.50.0050.00913.97
5.1.40.0080.00913.97
5.1.30.0120.00513.97
5.1.20.0080.00713.97
5.1.10.0070.00813.97
5.1.00.0080.00713.97
5.0.50.0100.00413.97
5.0.40.0070.00513.97
5.0.30.0080.00613.97
5.0.20.0070.00613.97
5.0.10.0070.00613.97
5.0.00.0050.00713.97
4.4.90.0010.00713.97
4.4.80.0040.00413.97
4.4.70.0060.00313.97
4.4.60.0070.00213.97
4.4.50.0060.00113.97
4.4.40.0070.00213.97
4.4.30.0000.00913.97
4.4.20.0050.00513.97
4.4.10.0060.00313.97
4.4.00.0050.00413.97
4.3.110.0040.00413.97
4.3.100.0050.00213.97
4.3.90.0050.00413.97
4.3.80.0060.00113.97
4.3.70.0020.00613.97
4.3.60.0050.00313.97
4.3.50.0050.00313.97
4.3.40.0040.00313.97
4.3.30.0040.00213.97
4.3.20.0020.00513.97
4.3.10.0060.00013.97
4.3.00.0050.00113.97

preferences:
48.2 ms | 401 KiB | 5 Q