3v4l.org

run code in 300+ PHP versions simultaneously
<?php function coolPluck($array, $lookup) { $output = array(); foreach($array as $k => $v) { if($k === $lookup) { $output[$k] = $v; } if(is_array($v)) { $results = coolPluck($v, $lookup); if(isset($results[$lookup]) && isset($output[$lookup])) { $output[$lookup][] = array_merge((array) $results[$lookup], (array) $output[$lookup]); } else { $output[$lookup] = array_merge($results, $output); } } } return $output; } $testArray = array('test' => array('percy' => array('percy' => 'hatcherson'), 'percy' => array('mitchell', 'anderson'))); var_dump(coolPluck($testArray, 'percy'));

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.0130.00616.63
8.3.50.0220.01016.47
8.3.40.0040.01118.84
8.3.30.0060.01618.45
8.3.20.0040.00418.77
8.3.10.0000.00818.70
8.3.00.0110.00019.51
8.2.180.0120.00316.63
8.2.170.0150.00022.96
8.2.160.0100.00718.96
8.2.150.0030.00624.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0080.00019.61
8.2.110.0060.00319.33
8.2.100.0040.00817.84
8.2.90.0080.00019.05
8.2.80.0080.00017.97
8.2.70.0060.00317.63
8.2.60.0040.00417.80
8.2.50.0000.00817.93
8.2.40.0000.00819.48
8.2.30.0030.00617.64
8.2.20.0050.00317.64
8.2.10.0000.00717.73
8.2.00.0070.00017.77
8.1.280.0060.00925.92
8.1.270.0000.00723.99
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0040.00422.62
8.1.230.0070.00417.89
8.1.220.0050.00317.78
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0030.00617.10
8.1.180.0080.00018.10
8.1.170.0000.00817.62
8.1.160.0070.00018.95
8.1.150.0070.00018.59
8.1.140.0040.00417.43
8.1.130.0040.00419.23
8.1.120.0040.00417.50
8.1.110.0040.00417.40
8.1.100.0040.00417.36
8.1.90.0030.00417.45
8.1.80.0040.00417.49
8.1.70.0070.00017.43
8.1.60.0040.00417.49
8.1.50.0000.00817.53
8.1.40.0030.00717.51
8.1.30.0030.00717.57
8.1.20.0040.00417.60
8.1.10.0040.00417.59
8.1.00.0040.00417.37
8.0.300.0000.00818.77
8.0.290.0040.00416.75
8.0.280.0000.00818.55
8.0.270.0030.00317.28
8.0.260.0030.00616.85
8.0.250.0080.00016.89
8.0.240.0000.00816.91
8.0.230.0040.00316.90
8.0.220.0050.00216.78
8.0.210.0070.00316.78
8.0.200.0000.00716.95
8.0.190.0040.00417.00
8.0.180.0000.00716.93
8.0.170.0030.00616.91
8.0.160.0030.00616.92
8.0.150.0000.00716.74
8.0.140.0030.00516.84
8.0.130.0060.00013.30
8.0.120.0090.00016.76
8.0.110.0080.00016.91
8.0.100.0040.00417.03
8.0.90.0000.00716.93
8.0.80.0090.00616.84
8.0.70.0000.00716.86
8.0.60.0060.00216.94
8.0.50.0000.00716.91
8.0.30.0100.00717.38
8.0.20.0160.00517.05
8.0.10.0080.00017.03
8.0.00.0080.01416.71
7.4.330.0000.00513.02
7.4.320.0040.00416.54
7.4.300.0000.00616.63
7.4.290.0000.00716.52
7.4.280.0070.00316.50
7.4.270.0070.00016.50
7.4.260.0000.00613.24
7.4.250.0030.00716.50
7.4.240.0070.00016.43
7.4.230.0030.00316.43
7.4.220.0110.01116.49
7.4.210.0150.00416.70
7.4.200.0040.00416.63
7.4.190.0030.00516.54
7.4.160.0060.01916.42
7.4.150.0120.00616.70
7.4.140.0080.01617.86
7.4.130.0150.00616.53
7.4.120.0100.00716.29
7.4.110.0040.01516.66
7.4.100.0130.00416.56
7.4.90.0140.00916.61
7.4.80.0030.01319.39
7.4.70.0080.00816.45
7.4.60.0110.00716.41
7.4.50.0030.00616.39
7.4.40.0030.01416.63
7.4.30.0130.00316.44
7.4.00.0090.00614.98
7.3.330.0040.00413.30
7.3.320.0050.00213.30
7.3.310.0000.00716.23
7.3.300.0000.00616.39
7.3.290.0090.01116.38
7.3.280.0060.01316.31
7.3.270.0070.01116.57
7.3.260.0030.01616.41
7.3.240.0080.00816.43
7.3.230.0130.00316.58
7.3.210.0100.01616.47
7.3.200.0130.00416.75
7.3.190.0030.01316.64
7.3.180.0130.00316.33
7.3.170.0140.00316.39
7.3.160.0120.00416.41
7.3.120.0070.01014.77
7.3.10.0070.00716.63
7.3.00.0110.00416.54
7.2.330.0100.01016.69
7.2.320.0100.00716.75
7.2.310.0140.01016.74
7.2.300.0110.01016.76
7.2.290.0070.01016.57
7.2.130.0040.01116.93
7.2.120.0070.00716.88
7.2.110.0040.01216.93
7.2.100.0040.00717.04
7.2.90.0100.00716.75
7.2.80.0090.00616.98
7.2.70.0000.01517.09
7.2.60.0070.00716.86
7.2.50.0000.01317.02
7.2.40.0100.00716.67
7.2.30.0150.00016.87
7.2.20.0040.00716.94
7.2.10.0070.00416.87
7.2.00.0020.01218.02
7.1.250.0030.01015.78
7.1.100.0030.00717.95
7.1.70.0030.00617.26
7.1.60.0070.01019.21
7.1.50.0130.01317.07
7.1.00.0030.07022.44
7.0.200.0000.00816.94
7.0.140.0030.07321.92
7.0.120.0030.07322.12
7.0.60.0070.04720.04
7.0.50.0030.07317.87
7.0.40.0070.07320.29
7.0.30.0300.04720.23
7.0.20.0200.04720.22
7.0.10.0270.04020.18
7.0.00.0030.04020.32
5.6.280.0100.06721.10
5.6.210.0070.08320.59
5.6.200.0070.07018.16
5.6.190.0230.03720.42
5.6.180.0230.08320.49
5.6.170.0230.04720.47
5.6.160.0130.07720.57
5.6.150.0070.07718.17
5.6.140.0030.08718.18
5.6.130.0070.08718.18
5.6.120.0030.08320.90
5.6.110.0170.07320.99
5.6.100.0000.09021.13
5.6.90.0200.07020.99
5.6.80.0200.06320.41
5.6.70.0270.07320.50
5.5.350.0070.03720.37
5.5.340.0000.04717.94
5.5.330.0030.04020.37
5.5.320.0030.07720.25
5.5.310.0200.04320.34
5.5.300.0030.08717.98
5.5.290.0030.09018.04
5.5.280.0070.04320.85
5.5.270.0100.08320.98
5.5.260.0000.04320.89
5.5.250.0070.08320.50
5.5.240.0070.08020.26
5.4.450.0070.04719.18
5.4.440.0030.04319.18
5.4.430.0070.05019.47
5.4.420.0070.04019.44
5.4.410.0030.04319.32
5.4.400.0130.07019.16
5.4.390.0070.04319.15
5.4.380.0070.05019.14
5.4.370.0000.06018.98
5.4.360.0030.08018.97
5.4.350.0070.07719.24
5.4.340.0070.03719.16
5.4.320.0100.07318.92
5.4.310.0130.06719.14
5.4.300.0100.07319.24
5.4.290.0070.05719.14
5.4.280.0070.04319.20
5.4.270.0030.05318.97
5.4.260.0100.07019.24
5.4.250.0070.07319.14
5.4.240.0070.03718.87
5.4.230.0100.07319.23
5.4.220.0030.04019.13
5.4.210.0030.08319.23
5.4.200.0130.06719.14
5.4.190.0130.05718.86
5.4.180.0070.03719.14
5.4.170.0070.08019.00
5.4.160.0100.07318.96
5.4.150.0130.07019.22
5.4.140.0000.04316.39
5.4.130.0000.05716.43
5.4.120.0070.03716.37
5.4.110.0100.07016.38
5.4.100.0070.05716.37
5.4.90.0070.05316.53
5.4.80.0100.06316.36
5.4.70.0070.04716.42
5.4.60.0100.06016.50
5.4.50.0070.07716.27
5.4.40.0100.06016.28
5.4.30.0070.03716.25
5.4.20.0100.06716.34
5.4.10.0030.08016.64
5.4.00.0030.05015.87
5.3.290.0200.06714.82
5.3.280.0100.03314.76
5.3.270.0130.04014.60
5.3.260.0070.04314.66
5.3.250.0000.04014.61
5.3.240.0000.05014.62
5.3.230.0000.07014.67
5.3.220.0070.04014.48
5.3.210.0070.04314.58
5.3.200.0070.07314.56
5.3.190.0170.03714.56
5.3.180.0070.06014.63
5.3.170.0100.06714.72
5.3.160.0100.03714.71
5.3.150.0130.05714.59
5.3.140.0070.04714.57
5.3.130.0030.04014.71
5.3.120.0100.07314.47
5.3.110.0000.05014.58
5.3.100.0070.03714.04
5.3.90.0030.07714.18
5.3.80.0130.05314.02
5.3.70.0070.06714.09
5.3.60.0070.04014.06
5.3.50.0100.06713.95
5.3.40.0100.06713.89
5.3.30.0170.06313.86
5.3.20.0000.04713.73
5.3.10.0030.07013.65
5.3.00.0030.07313.64
5.2.170.0070.04311.15
5.2.160.0070.05311.20
5.2.150.0070.04711.07
5.2.140.0000.04311.19
5.2.130.0070.05711.16
5.2.120.0070.02711.00
5.2.110.0070.05311.15
5.2.100.0030.04311.10
5.2.90.0070.04311.11
5.2.80.0100.04711.13
5.2.70.0100.03011.17
5.2.60.0100.05711.20
5.2.50.0030.05711.08
5.2.40.0070.05710.96
5.2.30.0100.05711.02
5.2.20.0030.04010.96
5.2.10.0000.05310.87
5.2.00.0070.02710.61
5.1.60.0000.0439.91
5.1.50.0030.02310.00
5.1.40.0000.06010.06
5.1.30.0030.05710.30
5.1.20.0000.03010.27
5.1.10.0100.05310.12
5.1.00.0100.0379.98
5.0.50.0000.0378.61
5.0.40.0000.0308.41
5.0.30.0000.0338.17
5.0.20.0070.0378.28
5.0.10.0000.0238.09
5.0.00.0030.0308.17
4.4.90.0030.0277.92
4.4.80.0030.0207.92
4.4.70.0030.0177.92
4.4.60.0000.0307.92
4.4.50.0030.0337.92
4.4.40.0000.0277.92
4.4.30.0030.0137.92
4.4.20.0030.0377.92
4.4.10.0030.0277.92
4.4.00.0070.0507.92
4.3.110.0030.0307.92
4.3.100.0000.0307.92
4.3.90.0000.0177.92
4.3.80.0000.0277.92
4.3.70.0000.0177.92
4.3.60.0030.0137.92
4.3.50.0000.0307.92
4.3.40.0000.0507.92
4.3.30.0030.0277.92
4.3.20.0070.0337.92
4.3.10.0000.0237.92
4.3.00.0070.0277.92

preferences:
51.75 ms | 401 KiB | 5 Q