3v4l.org

run code in 300+ PHP versions simultaneously
<?php function compareCombinations($toFind, $toTry){ $nb = 4; $goodPlace = 0; $wrongPlace = 0; $toFind = str_split($toFind); $toTry = str_split($toTry); var_dump($toFind, $toTry); //Look for good places for($i = 0; $i < $nb; $i++){ if($toFind[$i] === $toTry[$i]){ $goodPlace++; } } //Look for wrong places for($i = 0; $i < $nb; $i++){ for($j = 0; $j < $nb; $j++){ if($i == $j){ continue; } if($toTry[$i] === $toFind[$j]){ $wrongPlace++; } } } return array( 'good' => $goodPlace, 'wrong' => $wrongPlace, 'absent' => $nb - $goodPlace - $wrongPlace ); } foreach(array('0000' => '0001') as $find => $try){ $r = compareCombinations($find,$try); var_dump(array( 'find' => $find, 'try' => $try ) + $r); }

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.3.60.0170.00318.55
8.3.50.0130.00321.21
8.3.40.0140.00418.82
8.3.30.0150.00619.27
8.3.20.0040.00420.20
8.3.10.0040.00421.92
8.3.00.0080.00022.52
8.2.180.0080.00816.63
8.2.170.0000.01822.96
8.2.160.0090.00619.04
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0060.01226.16
8.2.120.0040.00419.54
8.2.110.0160.00321.05
8.2.100.0090.00317.84
8.2.90.0030.00518.02
8.2.80.0000.00917.97
8.2.70.0030.00517.75
8.2.60.0060.00317.93
8.2.50.0060.00318.07
8.2.40.0040.00417.97
8.2.30.0030.00518.05
8.2.20.0000.00717.82
8.2.10.0040.00417.79
8.2.00.0050.00317.73
8.1.280.0150.00025.92
8.1.270.0000.00818.63
8.1.260.0000.00826.35
8.1.250.0140.00328.09
8.1.240.0070.00321.83
8.1.230.0080.00321.04
8.1.220.0000.00917.74
8.1.210.0040.00418.77
8.1.200.0060.00317.23
8.1.190.0000.00817.41
8.1.180.0080.00018.62
8.1.170.0050.00318.50
8.1.160.0040.00422.14
8.1.150.0040.00418.65
8.1.140.0040.00417.36
8.1.130.0000.00817.82
8.1.120.0000.00717.38
8.1.110.0040.00417.39
8.1.100.0020.00517.35
8.1.90.0030.00317.41
8.1.80.0000.00717.35
8.1.70.0070.00017.42
8.1.60.0080.00017.47
8.1.50.0050.00317.47
8.1.40.0000.00717.52
8.1.30.0000.00717.62
8.1.20.0030.00517.66
8.1.10.0030.00517.61
8.1.00.0000.00917.50
8.0.300.0000.00719.98
8.0.290.0050.00317.04
8.0.280.0020.00518.29
8.0.270.0070.00017.11
8.0.260.0080.00016.72
8.0.250.0070.00016.97
8.0.240.0040.00416.87
8.0.230.0030.00316.94
8.0.220.0000.00716.97
8.0.210.0040.00416.79
8.0.200.0030.00316.94
8.0.190.0030.00516.85
8.0.180.0000.00716.82
8.0.170.0000.00716.80
8.0.160.0070.00016.76
8.0.150.0070.00016.80
8.0.140.0000.00716.86
8.0.130.0030.00313.35
8.0.120.0000.00716.88
8.0.110.0000.00716.86
8.0.100.0000.00716.80
8.0.90.0000.00716.92
8.0.80.0080.00816.87
8.0.70.0050.00316.67
8.0.60.0040.00417.00
8.0.50.0020.00516.78
8.0.30.0170.00716.95
8.0.20.0120.00617.40
8.0.10.0040.00417.05
8.0.00.0120.00716.65
7.4.330.0000.00515.00
7.4.320.0070.00016.49
7.4.300.0030.00316.50
7.4.290.0030.00316.52
7.4.280.0030.00316.59
7.4.270.0000.00716.45
7.4.260.0000.00816.59
7.4.250.0070.00016.36
7.4.240.0020.00516.54
7.4.230.0040.00416.50
7.4.220.0120.00616.55
7.4.210.0070.00916.48
7.4.200.0000.00716.55
7.4.190.0000.00716.61
7.4.160.0080.00816.52
7.4.150.0090.00917.40
7.4.140.0120.01117.86
7.4.130.0050.01616.55
7.4.120.0070.01116.67
7.4.110.0070.01016.71
7.4.100.0140.00716.38
7.4.90.0030.01316.54
7.4.80.0100.01019.39
7.4.70.0170.00316.44
7.4.60.0080.01316.41
7.4.50.0080.00016.47
7.4.40.0060.00922.77
7.4.30.0140.00816.20
7.4.00.0100.00615.10
7.3.330.0020.00213.38
7.3.320.0050.00013.32
7.3.310.0040.00416.21
7.3.300.0000.00716.31
7.3.290.0170.00316.29
7.3.280.0100.00916.36
7.3.270.0140.00317.40
7.3.260.0150.00416.57
7.3.250.0140.00316.59
7.3.240.0090.00916.33
7.3.230.0110.00616.61
7.3.210.0070.01016.28
7.3.200.0090.00819.39
7.3.190.0100.00716.44
7.3.180.0000.02216.56
7.3.170.0030.01316.65
7.3.160.0090.00816.40
7.3.120.0090.00614.86
7.2.330.0090.00916.63
7.2.320.0130.01016.59
7.2.310.0090.01316.63
7.2.300.0160.00016.50
7.2.290.0130.00716.49
7.2.60.0040.01116.81
7.2.00.0030.01019.43
7.1.200.0090.00315.54
7.1.100.0060.00617.86
7.1.70.0030.00517.18
7.1.60.0080.01519.82
7.1.50.0120.00917.02
7.1.00.0030.07022.57
7.0.200.0000.00916.97
7.0.140.0030.07321.95
7.0.60.0130.07019.87
7.0.50.0130.07017.96
7.0.40.0030.04320.40
7.0.30.0270.04020.30
7.0.20.0270.08020.24
7.0.10.0400.04720.16
7.0.00.0070.07020.09
5.6.280.0070.07020.88
5.6.210.0070.04320.66
5.6.200.0000.04718.18
5.6.190.0070.09020.55
5.6.180.3170.04320.66
5.6.170.0300.07720.39
5.6.160.0000.09320.70
5.6.150.0130.03018.16
5.6.140.0030.04018.27
5.6.130.0170.07718.14
5.6.120.0030.05021.02
5.6.110.0070.08721.14
5.6.100.0030.04021.01
5.6.90.0130.07320.97
5.6.80.0100.05720.38
5.5.350.0200.07020.45
5.5.340.0000.05018.02
5.5.330.0100.08320.40
5.5.320.0100.05020.38
5.5.310.0330.07320.42
5.5.300.0070.08018.08
5.5.290.0000.06717.92
5.5.280.0100.08020.87
5.5.270.0030.04020.68
5.5.260.0170.07320.87
5.5.250.0100.07720.58
5.5.240.0200.06320.26
5.4.450.0030.06319.55
5.4.440.0630.05719.47
5.4.430.0570.06319.61
5.4.420.0070.06719.58
5.4.410.0670.05319.42
5.4.400.0330.06318.82
5.4.390.1300.05018.57
5.4.380.0270.05318.63
5.4.370.0200.04718.52
5.4.360.0200.04718.70
5.4.350.0100.05718.76
5.4.340.0200.04718.63
5.4.320.0030.04212.51
5.4.310.0070.03812.50
5.4.300.0070.03612.51
5.4.290.0040.04112.50
5.4.280.0040.04212.40
5.4.270.0070.03712.40
5.4.260.0070.03912.39
5.4.250.0130.04318.93
5.4.240.0030.05718.93
5.4.230.0130.05018.83
5.4.220.0100.05018.92
5.4.210.0100.07318.79
5.4.200.0270.03318.90
5.4.190.0070.05318.90
5.4.180.0000.05718.78
5.4.170.0000.05718.88
5.4.160.0030.06018.77
5.4.150.0070.05718.79
5.4.140.0100.04316.39
5.4.130.0130.04016.43
5.4.120.0130.04716.54
5.4.110.0030.05316.38
5.4.100.0130.04716.30
5.4.90.0100.04716.59
5.4.80.0130.05716.61
5.4.70.0070.04716.30
5.4.60.0070.05716.50
5.4.50.0100.04316.53
5.4.40.0030.05316.43
5.4.30.0100.04716.23
5.4.20.0100.04316.37
5.4.10.0130.05016.23
5.4.00.0130.04315.79
5.3.290.0080.03812.80
5.3.280.0100.05014.76
5.3.270.0100.04714.59
5.3.260.0000.06014.74
5.3.250.0030.05314.69
5.3.240.0130.04014.77
5.3.230.0070.05014.60
5.3.220.0000.06714.70
5.3.210.0000.07314.72
5.3.200.0030.05314.55
5.3.190.0070.05014.74
5.3.180.0170.04014.64
5.3.170.0100.04714.78
5.3.160.0070.05014.65
5.3.150.0100.04714.39
5.3.140.0030.05014.73
5.3.130.0070.05714.63
5.3.120.0070.05314.73
5.3.110.0070.05714.64
5.3.100.0000.06714.02
5.3.90.0070.05014.02
5.3.80.0130.06014.11
5.3.70.0100.05714.10
5.3.60.0070.05014.06
5.3.50.0070.04714.02
5.3.40.0100.04713.95
5.3.30.0170.04013.74
5.3.20.0170.03713.68
5.3.10.0070.04713.72
5.3.00.0100.07013.86
5.2.170.0100.03711.23
5.2.160.0070.03711.05
5.2.150.0030.04011.11
5.2.140.0000.04311.23
5.2.130.0070.03710.95
5.2.120.0100.03711.05
5.2.110.0030.04010.93
5.2.100.0070.05311.07
5.2.90.0000.04711.17
5.2.80.0000.04710.99
5.2.70.0070.04011.31
5.2.60.0130.03311.13
5.2.50.0100.03711.02
5.2.40.0170.04711.00
5.2.30.0130.04711.07
5.2.20.0070.04010.96
5.2.10.0070.04310.76
5.2.00.0070.04310.73
5.1.60.0070.0379.97
5.1.50.0030.04710.09
5.1.40.0000.05010.07
5.1.30.0070.04710.33
5.1.20.0030.05310.34
5.1.10.0070.04710.14
5.1.00.0130.04010.07
5.0.50.0130.0338.60
5.0.40.0000.0338.26
5.0.30.0070.0608.33
5.0.20.0100.0208.17
5.0.10.0000.0308.28
5.0.00.0100.0408.33
4.4.90.0070.0277.30
4.4.80.0030.0307.30
4.4.70.0030.0207.30
4.4.60.0000.0237.30
4.4.50.0030.0237.30
4.4.40.0000.0437.30
4.4.30.0030.0237.30
4.4.20.0100.0207.30
4.4.10.0070.0237.30
4.4.00.0030.0377.30
4.3.110.0000.0307.30
4.3.100.0070.0237.30
4.3.90.0030.0177.30
4.3.80.0000.0377.30
4.3.70.0070.0277.30
4.3.60.0070.0277.30
4.3.50.0030.0307.30
4.3.40.0030.0477.30
4.3.30.0070.0177.30
4.3.20.0000.0337.30
4.3.10.0000.0277.30
4.3.00.0000.0236.75

preferences:
42.22 ms | 401 KiB | 5 Q