3v4l.org

run code in 300+ PHP versions simultaneously
<?php $haystack = [7, 6, 14, 15, 8, 0, 1, 4, 5, 9]; $needles = [ [3, 2, 7, 6], [7, 6, 15, 14], [15,14,11,10], [1,3,5,7], [5,7,13,15], [13,15,9,11], [0,1,4,5], [4,5,12,13], ]; // assuming all needle values are unique and all values in each haystacks subarray are unique function getIndexOfMatchingArrays(array $needles, array $haystack) { if (!$haystack) { return -1; } foreach ($needles as $index => $needle) { if ($needle === array_intersect($needle, $haystack)) { $fullMatch[] = $index; } } return $fullMatch ?? -1; } var_export( getIndexOfMatchingArrays($needles, $haystack) );

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.70.0070.01518.43
8.3.60.0070.01416.88
8.3.50.0040.01116.47
8.3.40.0070.00721.90
8.3.30.0070.00718.67
8.3.20.0030.00524.18
8.3.10.0000.00724.66
8.3.00.0050.00326.16
8.2.190.0140.00016.58
8.2.180.0090.00625.92
8.2.170.0040.01119.04
8.2.160.0000.01422.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.01126.16
8.2.120.0040.00426.35
8.2.110.0060.00320.95
8.2.100.0030.00917.91
8.2.90.0030.00617.78
8.2.80.0080.00018.78
8.2.70.0060.00317.50
8.2.60.0030.00618.04
8.2.50.0000.00918.07
8.2.40.0040.00418.22
8.2.30.0040.00418.15
8.2.20.0000.00718.01
8.2.10.0040.00419.20
8.2.00.0000.00719.31
8.1.280.0070.01025.92
8.1.270.0040.00423.99
8.1.260.0110.00728.09
8.1.250.0030.00528.09
8.1.240.0080.00022.10
8.1.230.0040.00820.98
8.1.220.0050.00317.74
8.1.210.0030.00818.85
8.1.200.0030.00617.22
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0050.00318.66
8.1.160.0040.00418.98
8.1.150.0000.00718.82
8.1.140.0070.00018.91
8.1.130.0030.00321.95
8.1.120.0000.00717.38
8.1.110.0020.00517.46
8.1.100.0040.00417.37
8.1.90.0030.00517.54
8.1.80.0030.00517.50
8.1.70.0030.00317.38
8.1.60.0000.00917.59
8.1.50.0030.00617.43
8.1.40.0040.00417.39
8.1.30.0000.01017.60
8.1.20.0040.00417.56
8.1.10.0040.00417.57
8.1.00.0050.00317.46
8.0.300.0040.00420.09
8.0.290.0040.00416.63
8.0.280.0030.00318.46
8.0.270.0020.00518.02
8.0.260.0000.00720.24
8.0.250.0000.00716.87
8.0.240.0000.00817.04
8.0.230.0000.00717.03
8.0.220.0000.00716.91
8.0.210.0040.00416.82
8.0.200.0030.00316.88
8.0.190.0040.00416.98
8.0.180.0000.00716.84
8.0.170.0060.00316.94
8.0.160.0040.00416.83
8.0.150.0030.00516.82
8.0.140.0000.00716.75
8.0.130.0060.00013.38
8.0.120.0050.00316.89
8.0.110.0000.00716.79
8.0.100.0020.00516.74
8.0.90.0070.00016.90
8.0.80.0090.00616.89
8.0.70.0000.00816.88
8.0.60.0070.00016.74
8.0.50.0050.00216.93
8.0.30.0190.00317.02
8.0.20.0120.00717.12
8.0.10.0000.00816.93
8.0.00.0100.01016.86
7.4.330.0050.00015.55
7.4.320.0000.00616.50
7.4.300.0030.00316.59
7.4.290.0000.00716.43
7.4.280.0080.00016.52
7.4.270.0020.00516.43
7.4.260.0030.00313.30
7.4.250.0000.00716.45
7.4.240.0000.00716.63
7.4.230.0030.00316.60
7.4.220.0020.00516.70
7.4.210.0070.00916.64
7.4.200.0030.00516.63
7.4.130.0130.00416.53
7.4.120.0070.01016.55
7.4.110.0220.01616.48
7.4.100.0070.01716.44
7.4.90.0130.01016.34
7.4.80.0240.01216.55
7.4.70.0280.00516.61
7.4.60.0250.01516.52
7.4.50.0120.00916.33
7.4.40.0070.01116.41
7.4.30.0140.01016.50
7.4.20.0150.00316.21
7.4.10.0090.00916.34
7.4.00.0110.00816.38
7.3.330.0110.00016.33
7.3.320.0000.00613.25
7.3.310.0000.00716.37
7.3.300.0000.00716.28
7.3.290.0060.01016.39
7.3.260.0110.00716.38
7.3.230.0150.00816.37
7.3.220.0060.01616.55
7.3.210.0180.00316.66
7.3.200.0370.00316.72
7.3.190.0300.01216.23
7.3.180.0170.00616.45
7.3.170.0160.00816.34
7.3.160.0100.00716.66
7.3.150.0100.01516.30
7.3.140.0070.01116.45
7.3.130.0060.01216.38
7.3.120.0110.00716.22
7.3.110.0120.00916.17
7.3.100.0070.01716.42
7.3.90.0090.01216.28
7.3.80.0070.01116.34
7.3.70.0150.00816.37
7.3.60.0000.02016.36
7.3.50.0090.01216.44
7.3.40.0120.00916.27
7.3.30.0170.00716.18
7.3.20.0180.00916.21
7.3.10.0110.01016.44
7.3.00.0100.01016.68
7.2.340.0130.01316.54
7.2.330.0150.00916.77
7.2.320.0270.01516.81
7.2.310.0140.01016.79
7.2.300.0080.01216.62
7.2.290.0100.01016.44
7.2.280.0100.01116.51
7.2.270.0130.00916.63
7.2.260.0130.01016.79
7.2.250.0060.01816.56
7.2.240.0160.00516.43
7.2.230.0130.01016.65
7.2.220.0130.01216.52
7.2.210.0120.00616.68
7.2.200.0070.01516.45
7.2.190.0090.01616.44
7.2.180.0130.01316.34
7.2.170.0150.01116.45
7.2.160.0160.01016.44
7.2.150.0030.01716.62
7.2.140.0070.01316.55
7.2.130.0110.00716.83
7.2.120.0100.01016.54
7.2.110.0160.00416.74
7.2.100.0090.01216.64
7.2.90.0130.00616.79
7.2.80.0130.00716.58
7.2.70.0140.00816.82
7.2.60.0140.00416.68
7.2.50.0090.00916.73
7.2.40.0120.00916.61
7.2.30.0070.01116.61
7.2.20.0090.01216.66
7.2.10.0210.00916.84
7.2.00.0210.01116.77

preferences:
41.74 ms | 401 KiB | 5 Q