3v4l.org

run code in 300+ PHP versions simultaneously
<?php function map(array $array, array $keys) { $filter = function ($node) { return $node; }; foreach (array_reverse($keys) as $key) { $filter = function ($node) use ($filter, $key) { if ($key == '*') { return array_map(function ($branch) use ($filter) { return $filter($branch); }, $node); } return $filter($node[$key]); }; } return $filter($array); } $array = [ 'a' => [ 'b' => [ [ 'c' => 'foo', ], [ 'c' => 'bar', ], [ 'c' => 'qux', ], ], ], ]; $keys = ['a', 'b', '*', 'c']; var_dump(map($array, $keys));

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.0040.01518.43
8.3.50.0110.00521.14
8.3.40.0110.00418.76
8.3.30.0100.00320.38
8.3.20.0080.00020.16
8.3.10.0040.00422.09
8.3.00.0030.00522.50
8.2.180.0120.00316.50
8.2.170.0110.00422.96
8.2.160.0100.00722.13
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0030.00526.16
8.2.120.0040.00420.81
8.2.110.0030.00722.26
8.2.100.0120.00017.84
8.2.90.0080.00019.21
8.2.80.0080.00017.97
8.2.70.0060.00317.50
8.2.60.0050.00318.05
8.2.50.0080.00018.10
8.2.40.0040.00420.60
8.2.30.0040.00419.23
8.2.20.0000.00817.72
8.2.10.0000.00817.64
8.2.00.0090.00017.75
8.1.280.0180.00025.92
8.1.270.0080.00824.66
8.1.260.0070.00026.35
8.1.250.0050.00328.09
8.1.240.0030.00623.97
8.1.230.0030.00922.13
8.1.220.0000.00717.78
8.1.210.0000.00818.77
8.1.200.0040.00717.35
8.1.190.0090.00017.23
8.1.180.0000.00718.10
8.1.170.0000.00818.45
8.1.160.0040.00419.01
8.1.150.0080.00018.81
8.1.140.0040.00417.46
8.1.130.0030.00317.78
8.1.120.0070.00017.39
8.1.110.0050.00217.36
8.1.100.0000.00817.32
8.1.90.0020.00517.33
8.1.80.0000.00717.34
8.1.70.0030.00317.41
8.1.60.0000.00917.58
8.1.50.0050.00317.55
8.1.40.0040.00417.49
8.1.30.0080.00017.58
8.1.20.0080.00017.71
8.1.10.0000.00717.63
8.1.00.0060.00317.46
8.0.300.0040.00418.77
8.0.290.0000.00716.75
8.0.280.0000.00718.36
8.0.270.0000.00717.28
8.0.260.0070.00016.83
8.0.250.0000.00716.88
8.0.240.0060.00316.92
8.0.230.0000.00816.90
8.0.220.0080.00016.82
8.0.210.0000.00716.81
8.0.200.0030.00316.93
8.0.190.0030.00416.87
8.0.180.0040.00416.88
8.0.170.0050.00216.90
8.0.160.0030.00316.93
8.0.150.0040.00416.86
8.0.140.0040.00416.76
8.0.130.0050.00013.37
8.0.120.0000.00816.79
8.0.110.0000.00716.86
8.0.100.0040.00416.77
8.0.90.0040.00416.89
8.0.80.0060.01016.88
8.0.70.0070.00016.89
8.0.60.0000.00716.95
8.0.50.0000.00816.79
8.0.30.0150.00317.28
8.0.20.0110.00717.40
8.0.10.0040.00416.92
8.0.00.0070.01416.85
7.4.330.0070.00015.00
7.4.320.0000.00616.49
7.4.300.0030.00316.52
7.4.290.0000.00716.50
7.4.280.0040.00416.61
7.4.270.0040.00416.53
7.4.260.0000.00713.31
7.4.250.0000.00716.56
7.4.240.0030.00416.51
7.4.230.0030.00316.63
7.4.220.0090.00916.58
7.4.210.0090.00716.54
7.4.200.0000.00716.41
7.4.190.0030.00316.65
7.4.160.0100.00716.46
7.4.150.0150.00617.40
7.4.140.0140.00317.86
7.4.130.0120.00516.48
7.4.120.0110.00616.62
7.4.110.0070.01016.54
7.4.100.0050.01416.47
7.4.90.0090.00916.56
7.4.80.0170.00019.39
7.4.70.0090.00816.47
7.4.60.0100.01016.72
7.4.50.0030.00616.43
7.4.40.0090.00622.77
7.4.30.0160.00316.49
7.4.00.0050.00814.84
7.3.330.0050.00013.36
7.3.320.0000.00613.24
7.3.310.0000.00616.30
7.3.300.0020.00516.38
7.3.290.0150.00016.39
7.3.280.0130.00716.38
7.3.270.0070.01017.40
7.3.260.0070.01016.45
7.3.250.0140.00516.35
7.3.240.0030.01316.68
7.3.230.0090.00916.40
7.3.210.0130.00316.36
7.3.200.0210.00019.39
7.3.190.0140.00316.52
7.3.180.0150.00616.59
7.3.170.0080.00816.60
7.3.160.0120.00616.54
7.3.120.0140.00015.10
7.2.330.0090.00916.69
7.2.320.0180.00016.44
7.2.310.0080.00816.76
7.2.300.0070.01016.70
7.2.290.0060.01216.70
7.2.60.0040.00816.91
7.2.00.0000.01419.43
7.1.200.0100.00715.62
7.1.100.0000.01118.16
7.1.70.0000.01117.25
7.1.60.0100.01319.29
7.1.50.0070.01417.11
7.1.00.0030.07322.28
7.0.200.0030.00716.50
7.0.140.0030.07322.10
7.0.100.0030.08720.07
7.0.90.0330.08019.92
7.0.80.0300.05720.04
7.0.70.0030.08020.14
7.0.60.0100.08719.99
7.0.50.0200.08020.31
7.0.40.0100.06320.14
7.0.30.0100.08320.00
7.0.20.0000.06720.15
7.0.10.0130.07319.99
7.0.00.0100.08020.08
5.6.280.0000.07721.08
5.6.250.0200.06720.82
5.6.240.0100.08020.61
5.6.230.0030.06720.73
5.6.220.0130.04320.63
5.6.210.0200.07720.73
5.6.200.0200.07320.97
5.6.190.0000.09321.04
5.6.180.0100.08021.05
5.6.170.0030.09021.01
5.6.160.0100.08321.07
5.6.150.0100.08020.96
5.6.140.0000.08321.03
5.6.130.0270.06721.09
5.6.120.0030.09021.02
5.6.110.0170.06321.08
5.6.100.0100.08021.02
5.6.90.0030.05321.03
5.6.80.0100.07020.54
5.6.70.0070.08020.41
5.6.60.0070.06320.40
5.6.50.0030.08320.46
5.6.40.0100.08020.41
5.6.30.0130.07320.29
5.6.20.0130.06320.42
5.6.10.0100.05720.46
5.6.00.0070.07720.40
5.5.380.0100.08020.43
5.5.370.0030.08720.51
5.5.360.0100.08020.37
5.5.350.0030.09020.43
5.5.340.0200.07320.94
5.5.330.0130.06720.92
5.5.320.0070.07720.85
5.5.310.0130.04720.94
5.5.300.0130.07720.64
5.5.290.0130.07720.94
5.5.280.0100.07320.94
5.5.270.0070.05020.75
5.5.260.0100.08020.81
5.5.250.0200.08020.59
5.5.240.0200.06020.27
5.5.230.0070.07720.31
5.5.220.0000.08320.31
5.5.210.0030.08020.12
5.5.200.0100.08720.14
5.5.190.0200.07020.12
5.5.180.0030.08320.27
5.5.160.0030.04720.24
5.5.150.0100.07720.13
5.5.140.0100.08720.23
5.5.130.0100.08020.23
5.5.120.0130.07020.13
5.5.110.0130.05720.12
5.5.100.0130.06720.18
5.5.90.0170.07020.16
5.5.80.0170.06320.18
5.5.70.0030.07020.10
5.5.60.0030.08020.15
5.5.50.0130.07320.13
5.5.40.0130.07320.07
5.5.30.0130.08320.16
5.5.20.0100.07319.94
5.5.10.0070.07320.14
5.5.00.0100.06720.12
5.4.450.0030.08319.24
5.4.440.0030.05319.22
5.4.430.0130.06719.44
5.4.420.0070.06319.45
5.4.410.0170.06719.36
5.4.400.0030.07019.09
5.4.390.0100.06718.93
5.4.380.0070.07318.87
5.4.370.0130.07019.02
5.4.360.0100.07319.18
5.4.350.0100.06019.16
5.4.340.0100.07319.18
5.4.320.0130.05019.09
5.4.310.0070.08019.09
5.4.300.0100.06319.12
5.4.290.0070.07318.85
5.4.280.0100.07719.13
5.4.270.0130.06318.93
5.4.260.0070.07319.12
5.4.250.0100.08019.11
5.4.240.0070.06719.17
5.4.230.0030.05318.94
5.4.220.0000.08018.86
5.4.210.0100.07319.08
5.4.200.0000.06319.19
5.4.190.0130.07019.02
5.4.180.0130.06318.93
5.4.170.0100.07718.89
5.4.160.0070.07719.04
5.4.150.0100.07019.21
5.4.140.0070.05716.47
5.4.130.0030.05716.49
5.4.120.0130.06016.46
5.4.110.0130.07016.50
5.4.100.0130.06316.53
5.4.90.0100.05716.57
5.4.80.0100.07716.51
5.4.70.0030.04316.49
5.4.60.0070.06716.48
5.4.50.0200.05316.31
5.4.40.0030.05016.39
5.4.30.0100.06716.41
5.4.20.0030.06016.44
5.4.10.0000.07716.47
5.4.00.0100.03715.79
5.3.290.0070.08314.80
5.3.280.0100.06714.71
5.3.270.0030.08314.69
5.3.260.0070.07314.67
5.3.250.0100.04014.66
5.3.240.0070.04014.56
5.3.230.0130.07014.54
5.3.220.0100.05714.72
5.3.210.0070.07314.70
5.3.200.0100.06014.57
5.3.190.0100.07714.70
5.3.180.0100.07714.64
5.3.170.0030.07014.56
5.3.160.0030.07314.55
5.3.150.0100.04014.56
5.3.140.0030.06314.58
5.3.130.0070.07714.51
5.3.120.0070.05314.63
5.3.110.0130.06714.52
5.3.100.0070.06014.08
5.3.90.0100.03714.10
5.3.80.0100.04714.13
5.3.70.0070.03714.02
5.3.60.0130.06714.14
5.3.50.0170.06013.85
5.3.40.0230.03314.10
5.3.30.0100.05313.93
5.3.20.0030.07313.85
5.3.10.0030.07313.85
5.3.00.0230.05313.85
5.2.170.0170.07013.85
5.2.160.0030.06313.85
5.2.150.0070.05313.85
5.2.140.0030.05313.85
5.2.130.0070.06013.85
5.2.120.0070.05713.85
5.2.110.0070.06013.85
5.2.100.0000.06713.85
5.2.90.0070.05713.85
5.2.80.0000.03713.85
5.2.70.0000.06313.85
5.2.60.0070.05313.85
5.2.50.0030.04013.85
5.2.40.0070.03713.85
5.2.30.0070.05313.85
5.2.20.0070.05313.85
5.2.10.0000.06013.85
5.2.00.0000.06013.85
5.1.60.0030.05313.85
5.1.50.0000.05713.85
5.1.40.0000.04713.85
5.1.30.0030.05713.85
5.1.20.0070.05013.85
5.1.10.0070.04013.85
5.1.00.0070.04313.85
5.0.50.0100.01713.85
5.0.40.0030.04013.85
5.0.30.0070.05713.85
5.0.20.0070.04013.85
5.0.10.0030.04713.85
5.0.00.0000.07013.85
4.4.90.0030.03713.85
4.4.80.0100.02713.85
4.4.70.0000.04313.85
4.4.60.0000.03713.85
4.4.50.0030.04013.85
4.4.40.0000.05013.85
4.4.30.0070.03013.85
4.4.20.0000.03713.85
4.4.10.0000.03713.85
4.4.00.0000.05013.85
4.3.110.0000.03313.85
4.3.100.0000.03013.85
4.3.90.0000.03713.85
4.3.80.0000.05013.85
4.3.70.0100.02713.85
4.3.60.0000.03713.85
4.3.50.0070.02013.85
4.3.40.0000.05013.85
4.3.30.0000.03713.85
4.3.20.0000.02013.85
4.3.10.0030.03313.85
4.3.00.0000.03313.85

preferences:
46.7 ms | 401 KiB | 5 Q