3v4l.org

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

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.0150.00016.50
8.3.50.0180.00817.37
8.3.40.0150.00018.81
8.3.30.0070.01118.71
8.3.20.0060.00318.63
8.3.10.0050.00318.76
8.3.00.0000.00819.25
8.2.180.0090.00616.50
8.2.170.0070.01022.96
8.2.160.0040.01118.79
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0070.00019.89
8.2.110.0100.00019.27
8.2.100.0000.01217.78
8.2.90.0030.00519.21
8.2.80.0030.00617.97
8.2.70.0060.00317.75
8.2.60.0040.00418.04
8.2.50.0050.00318.04
8.2.40.0030.00519.35
8.2.30.0030.00617.84
8.2.20.0100.00017.78
8.2.10.0040.00417.78
8.2.00.0080.00017.77
8.1.280.0060.00925.92
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0080.00022.58
8.1.230.0080.00317.89
8.1.220.0000.00817.80
8.1.210.0030.00618.77
8.1.200.0060.00317.35
8.1.190.0000.00817.35
8.1.180.0030.00618.10
8.1.170.0080.00017.62
8.1.160.0030.00319.05
8.1.150.0030.00518.73
8.1.140.0040.00417.52
8.1.130.0040.00419.22
8.1.120.0040.00417.47
8.1.110.0070.00017.36
8.1.100.0030.00517.33
8.1.90.0040.00417.53
8.1.80.0000.00717.41
8.1.70.0000.00717.38
8.1.60.0000.00817.52
8.1.50.0040.00417.42
8.1.40.0040.00417.58
8.1.30.0040.00717.64
8.1.20.0000.00817.66
8.1.10.0000.00717.63
8.1.00.0000.00817.54
8.0.300.0050.00218.77
8.0.290.0000.00716.75
8.0.280.0080.00018.70
8.0.270.0080.00017.29
8.0.260.0070.00016.84
8.0.250.0030.00617.03
8.0.240.0030.00316.97
8.0.230.0040.00416.95
8.0.220.0030.00316.96
8.0.210.0060.00316.85
8.0.200.0040.00416.92
8.0.190.0040.00417.02
8.0.180.0040.00416.82
8.0.170.0030.00516.92
8.0.160.0050.00516.92
8.0.150.0040.00416.93
8.0.140.0030.00616.78
8.0.130.0050.00013.30
8.0.120.0000.00816.74
8.0.110.0040.00416.77
8.0.100.0030.00616.89
8.0.90.0000.00716.78
8.0.80.0060.00916.80
8.0.70.0000.00716.79
8.0.60.0000.00816.89
8.0.50.0060.00316.94
8.0.30.0080.00617.32
8.0.20.0150.00417.25
8.0.10.0050.00316.98
8.0.00.0100.00916.64
7.4.330.0050.00012.99
7.4.320.0030.00316.46
7.4.300.0060.00016.63
7.4.290.0030.00316.55
7.4.280.0040.00416.51
7.4.270.0000.00616.53
7.4.260.0060.00013.32
7.4.250.0100.00016.57
7.4.240.0030.00416.64
7.4.230.0080.00016.63
7.4.220.0090.00916.47
7.4.210.0040.01116.61
7.4.200.0040.00416.69
7.4.190.0040.00416.59
7.4.160.0030.02016.35
7.4.150.0080.00816.52
7.4.140.0160.00317.86
7.4.130.0160.00316.54
7.4.120.0110.01116.52
7.4.110.0030.01716.59
7.4.100.0110.00616.61
7.4.90.0070.01016.36
7.4.80.0130.00319.39
7.4.70.0130.00716.71
7.4.60.0040.01316.64
7.4.50.0050.00016.43
7.4.40.0060.01016.39
7.4.30.0090.00916.59
7.4.00.0000.01414.91
7.3.330.0030.00313.25
7.3.320.0040.00313.38
7.3.310.0040.00416.48
7.3.300.0070.00016.21
7.3.290.0090.00716.38
7.3.280.0100.00616.30
7.3.270.0030.01416.70
7.3.260.0110.01116.34
7.3.240.0130.00316.62
7.3.230.0100.00816.39
7.3.210.0100.00716.66
7.3.200.0100.00716.73
7.3.190.0060.00916.54
7.3.180.0090.00916.63
7.3.170.0090.00616.29
7.3.160.0120.00316.41
7.3.120.0030.01414.63
7.3.10.0000.01416.77
7.3.00.0060.00716.76
7.2.330.0150.00616.75
7.2.320.0070.01416.70
7.2.310.0100.01316.46
7.2.300.0060.01216.61
7.2.290.0120.00616.63
7.2.130.0070.00717.01
7.2.120.0040.00916.91
7.2.110.0030.00916.81
7.2.100.0050.01116.71
7.2.90.0050.01116.90
7.2.80.0060.00716.83
7.2.70.0050.00916.87
7.2.60.0100.00316.85
7.2.50.0050.00917.00
7.2.40.0020.01117.00
7.2.30.0070.00416.89
7.2.20.0030.00917.04
7.2.10.0100.00416.96
7.2.00.0070.00516.84
7.1.250.0070.00515.89
7.1.240.0060.00615.88
7.1.230.0030.00915.64
7.1.220.0060.00615.90
7.1.210.0000.01015.87
7.1.200.0040.00415.74
7.1.190.0040.01115.58
7.1.180.0030.00915.57
7.1.170.0040.00415.88
7.1.160.0080.00315.87
7.1.150.0030.00615.71
7.1.140.0060.00315.89
7.1.130.0030.00815.75
7.1.120.0060.00615.55
7.1.110.0000.01415.61
7.1.100.0070.00315.84
7.1.90.0000.01015.88
7.1.80.0030.00716.03
7.1.70.0050.00816.58
7.1.60.0090.00917.51
7.1.50.0160.00925.17
7.1.40.0030.00715.91
7.1.30.0040.00715.91
7.1.20.0040.00715.86
7.1.10.0040.00415.93
7.1.00.0070.03719.12
7.0.330.0040.00415.20
7.0.320.0040.01015.36
7.0.310.0000.01115.61
7.0.300.0060.00915.56
7.0.290.0070.00715.21
7.0.280.0060.00815.43
7.0.270.0120.00815.51
7.0.260.0060.00615.28
7.0.250.0070.00415.04
7.0.240.0030.00615.48
7.0.230.0060.00315.35
7.0.220.0100.00015.39
7.0.210.0000.00915.41
7.0.200.0070.00216.10
7.0.190.0000.01015.35
7.0.180.0030.00615.25
7.0.170.0040.00715.36
7.0.160.0000.01115.57
7.0.150.0030.01015.19
7.0.140.0030.04018.59
7.0.130.0030.00615.49
7.0.120.0060.03118.77
7.0.110.0030.00615.30
7.0.100.0080.00315.39
7.0.90.0070.00415.16
7.0.80.0000.00915.16
7.0.70.0000.00715.29
7.0.60.0070.03517.57
7.0.50.0020.04316.68
7.0.40.0080.04215.51
7.0.30.0110.02515.59
7.0.20.0030.04415.69
7.0.10.0070.02615.51
7.0.00.0000.04315.55
5.6.380.0030.00914.00
5.6.370.0070.00013.98
5.6.360.0110.00014.09
5.6.350.0060.00314.34
5.6.340.0100.00014.39
5.6.330.0130.00614.05
5.6.320.0000.01114.03
5.6.310.0050.00514.34
5.6.300.0090.00414.07
5.6.290.0080.00314.63
5.6.280.0040.03917.53
5.6.270.0040.00414.09
5.6.260.0030.00714.25
5.6.250.0060.00314.15
5.6.240.0000.01114.43
5.6.230.0060.00314.63
5.6.220.0030.01014.23
5.6.210.0080.02017.40
5.6.200.0020.04516.21
5.6.190.0020.03316.34
5.6.180.0090.01916.29
5.6.170.0100.04316.18
5.6.160.0050.04116.19
5.6.150.0060.04416.04
5.6.140.0050.03015.96
5.6.130.0070.04316.27
5.6.120.0070.04016.14
5.6.110.0050.03916.28
5.6.100.0030.04516.16
5.6.90.0030.03016.39
5.6.80.0070.04015.79
5.6.70.0050.02515.93
5.6.60.0040.02615.78
5.6.50.0050.03815.80
5.6.40.0100.03915.93
5.6.30.0030.04215.69
5.6.20.0050.02515.81
5.6.10.0030.02515.94
5.6.00.0050.03515.95
5.5.380.0040.00410.96
5.5.370.0060.00611.05
5.5.360.0070.00411.24
5.5.350.0070.02415.79
5.5.340.0040.04514.57
5.5.330.0080.04214.55
5.5.320.0020.02314.49
5.5.310.0030.02814.57
5.5.300.0040.04014.63
5.5.290.0060.02714.48
5.5.280.0060.04114.54
5.5.270.0070.04014.54
5.5.260.0030.02914.53
5.5.250.0070.03714.49
5.5.240.0070.04014.25
5.5.230.0020.03414.19
5.5.220.0050.02014.26
5.5.210.0000.02614.03
5.5.200.0060.03814.10
5.5.190.0090.02814.24
5.5.180.0010.02614.31
5.5.170.0070.00010.90
5.5.160.0130.02114.28
5.5.150.0070.03814.25
5.5.140.0140.03314.09
5.5.130.0080.03814.00
5.5.120.0040.03414.25
5.5.110.0050.02314.23
5.5.100.0060.03614.22
5.5.90.0000.02414.10
5.5.80.0030.02714.16
5.5.70.0090.03414.14
5.5.60.0050.03214.17
5.5.50.0090.02314.29
5.5.40.0020.04214.26
5.5.30.0080.03114.27
5.5.20.0070.02514.11
5.5.10.0050.02114.07
5.5.00.0080.03814.20
5.4.450.0090.02715.14
5.4.440.0040.02515.30
5.4.430.0020.04415.31
5.4.420.0080.03915.04
5.4.410.0090.03815.13
5.4.400.0070.03814.88
5.4.390.0080.03814.98
5.4.380.0050.02914.88
5.4.370.0070.02015.00
5.4.360.0050.04414.96
5.4.350.0080.03615.03
5.4.340.0040.03614.91
5.4.330.0030.00711.02
5.4.320.0060.03315.01
5.4.310.0040.03815.16
5.4.300.0030.04515.09
5.4.290.0070.03715.08
5.4.280.0050.02615.06
5.4.270.0030.04614.82
5.4.260.0020.03914.87
5.4.250.0050.02214.95
5.4.240.0020.02715.06
5.4.230.0040.03914.75
5.4.220.0100.02515.02
5.4.210.0060.03015.15
5.4.200.0050.04014.76
5.4.190.0030.03014.91
5.4.180.0090.02014.81
5.4.170.0030.03814.85
5.4.160.0110.03614.92
5.4.150.0070.03514.84
5.4.140.0030.02513.74
5.4.130.0040.03213.71
5.4.120.0050.03013.74
5.4.110.0030.02113.54
5.4.100.0030.02813.73
5.4.90.0030.02813.80
5.4.80.0080.03613.75
5.4.70.0030.02813.66
5.4.60.0020.02313.68
5.4.50.0050.02613.59
5.4.40.0050.02013.78
5.4.30.0080.01813.70
5.4.20.0050.03613.47
5.4.10.0060.03513.74
5.4.00.0030.02613.40
5.3.290.0020.02312.68
5.3.280.0030.02712.63
5.3.270.0070.02212.66
5.3.260.0020.03512.61
5.3.250.0060.02012.61
5.3.240.0070.04012.58
5.3.230.0020.04112.57
5.3.220.0030.03612.53
5.3.210.0050.04012.56
5.3.200.0060.02012.59
5.3.190.0050.02912.49
5.3.180.0020.03212.67
5.3.170.0070.04012.65
5.3.160.0100.02812.58
5.3.150.0080.03512.50
5.3.140.0040.02712.48
5.3.130.0040.02612.45
5.3.120.0070.02012.45
5.3.110.0060.02812.56
5.3.100.0100.03512.13
5.3.90.0050.03712.35
5.3.80.0050.03312.18
5.3.70.0070.03712.22
5.3.60.0050.02212.30
5.3.50.0050.03212.07
5.3.40.0100.02512.25
5.3.30.0030.03812.13
5.3.20.0120.01812.06
5.3.10.0050.03212.03
5.3.00.0030.03811.96
5.2.170.0050.03010.38
5.2.160.0110.02310.40
5.2.150.0050.03010.38
5.2.140.0010.03010.22
5.2.130.0050.01810.30
5.2.120.0070.02510.30
5.2.110.0030.02010.22
5.2.100.0040.03510.40
5.2.90.0000.02210.35
5.2.80.0050.03510.26
5.2.70.0050.03210.24
5.2.60.0030.03510.25
5.2.50.0070.02310.31
5.2.40.0020.03710.18
5.2.30.0030.03710.18
5.2.20.0030.03610.12
5.2.10.0060.0209.80
5.2.00.0010.0219.98
5.1.60.0020.0329.19
5.1.50.0000.0339.13
5.1.40.0020.0379.41
5.1.30.0050.0289.45
5.1.20.0010.0289.63
5.1.10.0030.0319.20
5.1.00.0020.0319.26
5.0.50.0020.0148.47
5.0.40.0060.0218.36
5.0.30.0040.0238.30
5.0.20.0020.0238.23
5.0.10.0000.0268.28
5.0.00.0040.0178.28
4.4.90.0030.0188.08
4.4.80.0000.0228.08
4.4.70.0030.0158.08
4.4.60.0020.0188.08
4.4.50.0020.0208.08
4.4.40.0030.0278.08
4.4.30.0020.0178.08
4.4.20.0020.0148.08
4.4.10.0020.0108.08
4.4.00.0020.0308.08
4.3.110.0060.0158.08
4.3.100.0030.0198.08
4.3.90.0060.0158.08
4.3.80.0000.0298.08
4.3.70.0000.0178.08
4.3.60.0030.0138.08
4.3.50.0020.0128.08
4.3.40.0020.0278.08
4.3.30.0020.0138.08
4.3.20.0020.0188.08
4.3.10.0010.0168.08
4.3.00.0000.0208.08

preferences:
45.38 ms | 401 KiB | 5 Q