3v4l.org

run code in 300+ PHP versions simultaneously
<?php $A = [3,45,67,8]; $B = [ 1 => [1,6,8], 2 => [5,67,3,4,5,66,6], 3 => [55,56,57,58], 4 => [45,80,81,82] ]; $result = []; foreach ($A as $needle) { if ($found = array_keys($B, $needle)) { // something qualified $result = array_merge($result, $found); // store the new key(s) $B = array_intersect($B, $found); // reduce the haystack } echo "Needle: $needle\n"; var_export($B); echo "\n--\n"; var_export($result); echo "\n----\n"; }

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.0060.01218.30
8.3.50.0090.00918.19
8.3.40.0130.00318.67
8.3.30.0110.00318.80
8.3.20.0040.00419.12
8.3.10.0040.00423.66
8.3.00.0080.00020.56
8.2.180.0100.01018.42
8.2.170.0120.00622.96
8.2.160.0070.00722.08
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0030.00626.16
8.2.120.0040.00420.92
8.2.110.0080.00321.07
8.2.100.0090.00317.72
8.2.90.0050.00317.89
8.2.80.0060.00318.04
8.2.70.0000.00817.78
8.2.60.0040.00418.16
8.2.50.0050.00318.10
8.2.40.0070.00019.42
8.2.30.0070.00019.18
8.2.20.0040.00417.97
8.2.10.0040.00418.20
8.2.00.0080.00017.60
8.1.280.0120.00325.92
8.1.270.0040.00420.65
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0090.00023.92
8.1.230.0060.00622.68
8.1.220.0040.00417.74
8.1.210.0080.00418.77
8.1.200.0060.00617.23
8.1.190.0000.00817.23
8.1.180.0000.00818.10
8.1.170.0050.00318.58
8.1.160.0040.00418.88
8.1.150.0080.00018.80
8.1.140.0060.00322.01
8.1.130.0000.00720.30
8.1.120.0070.00017.39
8.1.110.0050.00217.51
8.1.100.0040.00417.47
8.1.90.0040.00417.41
8.1.80.0000.00717.38
8.1.70.0000.00717.47
8.1.60.0040.00417.59
8.1.50.0040.00417.42
8.1.40.0070.00017.41
8.1.30.0000.00817.54
8.1.20.0000.00817.58
8.1.10.0040.00417.57
8.1.00.0040.00417.51
8.0.300.0070.00419.77
8.0.290.0030.00616.63
8.0.280.0040.00418.32
8.0.270.0030.00617.17
8.0.260.0030.00318.32
8.0.250.0030.00316.95
8.0.240.0030.00316.89
8.0.230.0030.00316.91
8.0.220.0000.00716.91
8.0.210.0000.00716.86
8.0.200.0000.00716.92
8.0.190.0030.00316.88
8.0.180.0000.00816.91
8.0.170.0000.00916.79
8.0.160.0040.00416.97
8.0.150.0070.00016.88
8.0.140.0000.00716.79
8.0.130.0000.00613.33
8.0.120.0040.00416.74
8.0.110.0000.00716.94
8.0.100.0070.00016.84
8.0.90.0000.00716.94
8.0.80.0080.01216.86
8.0.70.0040.00416.89
8.0.60.0040.00416.75
8.0.50.0000.00816.84
8.0.30.0110.00617.20
8.0.20.0090.01017.40
8.0.10.0000.00716.89
8.0.00.0110.00716.79
7.4.330.0030.00315.55
7.4.320.0030.00316.52
7.4.300.0000.00616.61
7.4.290.0030.00316.59
7.4.280.0070.00016.44
7.4.270.0000.00716.64
7.4.260.0000.00716.46
7.4.250.0030.00516.41
7.4.240.0080.00016.59
7.4.230.0000.00716.50
7.4.220.0080.00016.63
7.4.210.0070.01116.59
7.4.200.0030.00316.46
7.4.160.0100.00616.46
7.4.140.0140.00617.86
7.4.130.0060.01116.36
7.4.120.0090.00816.38
7.4.110.0060.01316.48
7.4.100.0090.00916.24
7.4.90.0090.00916.45
7.4.80.0070.01419.39
7.4.70.0030.01416.38
7.4.60.0030.01716.55
7.4.50.0040.01116.43
7.4.40.0090.00816.53
7.4.00.0060.01014.60
7.3.330.0050.00013.24
7.3.320.0030.00313.24
7.3.310.0030.00616.30
7.3.300.0070.00016.31
7.3.290.0070.00016.34
7.3.280.0090.00916.28
7.3.260.0100.00816.44
7.3.240.0090.00816.37
7.3.230.0170.00416.34
7.3.210.0030.01216.28
7.3.200.0000.02016.64
7.3.190.0060.01216.37
7.3.180.0070.01016.35
7.3.170.0150.00616.43
7.3.160.0100.00616.59
7.2.330.0090.00916.40
7.2.320.0110.00616.85
7.2.310.0140.00316.59
7.2.300.0070.01016.50
7.2.290.0130.00316.55
7.2.110.0240.00414.90
7.2.100.0130.01014.75
7.2.90.0240.00314.42
7.2.80.0270.00014.71
7.2.70.0170.00715.01
7.2.60.0340.00614.59
7.2.50.0240.00614.86
7.2.40.0210.01215.00
7.2.30.0140.00714.82
7.2.20.0240.00615.13
7.2.10.0210.00314.75
7.2.00.0220.00714.71
7.1.230.0200.01013.99
7.1.220.0250.00614.08
7.1.210.0110.01113.79
7.1.200.0210.00413.88
7.1.190.0300.00413.52
7.1.180.0210.00313.81
7.1.170.0240.01113.82
7.1.160.0190.01013.89
7.1.150.0180.00314.00
7.1.140.0190.01313.57
7.1.130.0130.01313.91
7.1.120.0270.01013.66
7.1.110.0310.00014.00
7.1.100.0170.00314.01
7.1.90.0130.00713.71
7.1.80.0160.00413.80
7.1.70.0860.00613.92
7.1.60.0510.01031.74
7.1.50.0300.01031.91
7.1.40.0340.00631.84
7.1.30.0350.00631.66
7.1.20.0280.01631.64
7.1.10.0290.00313.73
7.1.00.0130.00913.57
5.6.380.0060.01114.43

preferences:
68.74 ms | 401 KiB | 5 Q