3v4l.org

run code in 300+ PHP versions simultaneously
<?php function map(array $array, array $keys) { $filter = function ($branch) { return $branch; }; foreach ($keys as $key) { $filter = function ($branch) use ($filter, $key) { switch ($key) { case '*': case '?': return array_map(function () use ($dimension, $filter) { return $filter($dimension); }, $branch); default: return $filter($branch)[$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.0110.00418.43
8.3.50.0090.00617.45
8.3.40.0040.01118.88
8.3.30.0090.00618.70
8.3.20.0000.00918.73
8.3.10.0050.00520.52
8.3.00.0050.00317.63
8.2.180.0030.01716.63
8.2.170.0040.01122.96
8.2.160.0100.00722.12
8.2.150.0130.00324.18
8.2.140.0140.00424.66
8.2.130.0030.00626.16
8.2.120.0040.00419.96
8.2.110.0000.01120.92
8.2.100.0070.00417.97
8.2.90.0050.00319.27
8.2.80.0000.00818.03
8.2.70.0060.00317.63
8.2.60.0040.00417.93
8.2.50.0000.00818.07
8.2.40.0080.00018.22
8.2.30.0000.00718.21
8.2.20.0040.00417.81
8.2.10.0040.00417.84
8.2.00.0080.00017.83
8.1.280.0140.00725.92
8.1.270.0030.01523.99
8.1.260.0030.01026.35
8.1.250.0050.00328.09
8.1.240.0050.00522.55
8.1.230.0070.00420.85
8.1.220.0040.00418.77
8.1.210.0000.00919.04
8.1.200.0000.00917.35
8.1.190.0080.00017.53
8.1.180.0040.00418.10
8.1.170.0030.00620.65
8.1.160.0000.00718.80
8.1.150.0000.00718.53
8.1.140.0040.00417.49
8.1.130.0030.00317.84
8.1.120.0000.00717.48
8.1.110.0000.00817.36
8.1.100.0080.00017.44
8.1.90.0000.00717.45
8.1.80.0000.00817.39
8.1.70.0000.00717.44
8.1.60.0000.00717.52
8.1.50.0000.00717.44
8.1.40.0050.00317.56
8.1.30.0000.00717.54
8.1.20.0080.00017.58
8.1.10.0040.00417.47
8.1.00.0040.00417.49
8.0.300.0040.00420.02
8.0.290.0000.00716.75
8.0.280.0030.00318.48
8.0.270.0040.00417.26
8.0.260.0000.00816.84
8.0.250.0000.00716.94
8.0.240.0060.00517.01
8.0.230.0070.00016.96
8.0.220.0050.00316.93
8.0.210.0000.00717.01
8.0.200.0030.00316.92
8.0.190.0040.00416.96
8.0.180.0080.00017.05
8.0.170.0040.00416.89
8.0.160.0000.00717.01
8.0.150.0000.00916.95
8.0.140.0000.00716.92
8.0.130.0000.00513.46
8.0.120.0040.00416.82
8.0.110.0070.00016.79
8.0.100.0040.00416.97
8.0.90.0040.00416.87
8.0.80.0030.01317.00
8.0.70.0040.00416.97
8.0.60.0000.00716.92
8.0.50.0040.00416.80
8.0.30.0150.00617.15
8.0.20.0040.01417.20
8.0.10.0040.00417.14
8.0.00.0090.01116.86
7.4.330.0050.00014.78
7.4.320.0030.00316.51
7.4.300.0000.00616.49
7.4.290.0000.00616.52
7.4.280.0030.00616.53
7.4.270.0000.00616.66
7.4.260.0030.00313.30
7.4.250.0040.00416.50
7.4.240.0040.00416.68
7.4.230.0000.00716.51
7.4.220.0110.00816.61
7.4.210.0080.01016.54
7.4.200.0050.00316.47
7.4.190.0070.00016.48
7.4.160.0050.01116.29
7.4.150.0140.00417.07
7.4.140.0090.00817.13
7.4.130.0050.01116.65
7.4.120.0080.00816.73
7.4.110.0180.00016.73
7.4.100.0060.01016.62
7.4.90.0090.01216.51
7.4.80.0060.01118.80
7.4.70.0130.00916.44
7.4.60.0090.00916.30
7.4.50.0000.00916.20
7.4.40.0040.01122.27
7.4.30.0040.01216.59
7.4.00.0030.01015.12
7.3.330.0000.00713.43
7.3.320.0060.00013.39
7.3.310.0000.00716.25
7.3.300.0030.00316.32
7.3.290.0110.00316.39
7.3.280.0050.01116.46
7.3.270.0070.01017.07
7.3.260.0110.00718.24
7.3.250.0140.00316.47
7.3.240.0060.01016.57
7.3.230.0110.00616.73
7.3.210.0130.00516.49
7.3.200.0130.00319.39
7.3.190.0090.01216.45
7.3.180.0060.01316.38
7.3.170.0040.01316.40
7.3.160.0000.01516.51
7.3.120.0030.01015.04
7.3.10.0100.00316.43
7.3.00.0160.00616.52
7.2.330.0080.01116.78
7.2.320.0070.01116.79
7.2.310.0140.00916.48
7.2.300.0060.01116.67
7.2.290.0100.00716.77
7.2.130.0060.01116.63
7.2.120.0120.00616.35
7.2.110.0080.01116.52
7.2.100.0160.00416.61
7.2.90.0170.00716.05
7.2.80.0080.00316.77
7.2.70.0080.00416.75
7.2.60.0070.00416.79
7.2.50.0080.00616.57
7.2.40.0090.00616.76
7.2.30.0030.00716.46
7.2.20.0120.00916.84
7.2.10.0040.00816.64
7.2.00.0030.00918.13
7.1.250.0140.00615.56
7.1.200.0090.00615.89
7.1.100.0030.00618.26
7.1.70.0000.01017.29
7.1.60.0000.01417.25
7.1.50.0030.01017.09
7.1.40.0000.02116.68
7.1.30.0030.01316.56
7.1.20.0060.00616.52
7.1.10.0000.00816.67
7.1.00.0050.00516.79
7.0.200.0050.00516.77
7.0.190.0020.00716.63
7.0.180.0000.01016.25
7.0.170.0000.00716.51
7.0.160.0060.00316.25
7.0.150.0040.00416.21
7.0.140.0020.00716.44
7.0.130.0050.00516.41
7.0.120.0040.00416.65
7.0.110.0000.00916.59
7.0.100.0030.00816.55
7.0.90.0000.01016.49
7.0.80.0050.00516.70
7.0.70.0080.00016.64
7.0.60.0040.00416.43
7.0.50.0040.00416.58
7.0.40.0040.00415.26
7.0.30.0000.00915.26
7.0.20.0000.01015.26
7.0.10.0080.00015.26
7.0.00.0060.00315.26
5.6.300.0060.04220.68
5.6.290.0270.03120.59
5.6.280.0030.04621.06
5.6.270.0100.03721.00
5.6.260.0170.03621.09
5.6.250.0100.03921.09
5.6.240.0090.04221.08
5.6.230.0000.05721.07
5.6.220.0090.03421.06
5.6.210.0030.04220.86
5.6.200.0030.04321.03
5.6.190.0100.04621.05
5.6.180.0030.05121.01
5.6.170.0000.04920.88
5.6.160.0030.03921.05
5.6.150.0090.03520.86
5.6.140.0030.04621.00
5.6.130.0090.03520.93
5.6.120.0130.03621.05
5.6.110.0030.05020.94
5.6.100.0000.04421.03
5.6.90.0000.05620.79
5.6.80.0030.04520.27
5.6.70.0030.04820.38
5.6.60.0100.03620.21
5.6.50.0000.04420.33
5.6.40.0030.07820.31
5.6.30.0000.05220.28
5.6.20.0000.04820.39
5.6.10.0030.05220.20
5.6.00.0030.04120.33
5.5.380.0030.04617.66
5.5.370.0070.03917.55
5.5.360.0070.03917.57
5.5.350.0070.03617.64
5.5.340.0070.03618.04
5.5.330.0030.04317.84
5.5.320.0100.03618.10
5.5.310.0070.03718.14
5.5.300.0000.07418.09
5.5.290.0000.05318.13
5.5.280.0030.05418.09
5.5.270.0070.04318.09
5.5.260.0040.03917.74
5.5.250.0000.04617.91
5.5.240.0070.04617.43
5.5.230.0000.05417.41
5.5.220.0000.04417.09
5.5.210.0070.04317.34
5.5.200.0060.03917.45
5.5.190.0070.06117.41
5.5.180.0000.04217.49
5.5.160.0070.06417.48
5.5.150.0030.08717.48
5.5.140.0030.04017.36
5.5.130.0030.03917.45
5.5.120.0070.04717.21
5.5.110.0030.06817.34
5.5.100.0030.03917.39
5.5.90.0000.06217.39
5.5.80.0070.04316.95
5.5.70.0030.03817.27
5.5.60.0000.04117.33
5.5.50.0000.06917.41
5.5.40.0040.03617.10
5.5.30.0060.03417.41
5.5.20.0070.04017.25
5.5.10.0030.04117.37
5.5.00.0170.04717.37
5.4.450.0070.05219.48
5.4.440.0070.04319.40
5.4.430.0000.05619.54
5.4.420.0230.04619.25
5.4.410.0030.04319.27
5.4.400.0000.04219.08
5.4.390.0030.04219.10
5.4.380.0000.04519.12
5.4.370.0030.04018.99
5.4.360.0030.04819.21
5.4.350.0070.07719.21
5.4.340.0000.04418.90
5.4.320.0030.05219.17
5.4.310.0270.02718.96
5.4.300.0030.03819.13
5.4.290.0040.03919.07
5.4.280.0030.04918.88
5.4.270.0000.04118.98
5.4.260.0100.03618.98
5.4.250.0030.03919.03
5.4.240.0030.04119.14
5.4.230.0000.03918.98
5.4.220.0060.03518.98
5.4.210.0100.03519.12
5.4.200.0030.04718.92
5.4.190.0000.05518.97
5.4.180.0000.04319.13
5.4.170.0030.03918.98
5.4.160.0100.03918.93
5.4.150.0190.04519.09
5.4.140.0070.03216.74
5.4.130.0100.05516.72
5.4.120.0070.06116.75
5.4.110.0030.06016.69
5.4.100.0070.03416.65
5.4.90.0030.04016.77
5.4.80.0030.04516.80
5.4.70.0000.03816.79
5.4.60.0030.06416.73
5.4.50.0060.03416.48
5.4.40.0030.04916.76
5.4.30.0000.04316.71
5.4.20.0000.04116.46
5.4.10.0000.04616.46
5.4.00.0000.04215.94
5.3.290.0030.05515.26
5.3.280.0070.03515.26
5.3.270.0100.05115.26
5.3.260.0030.03715.26
5.3.250.0100.04515.26
5.3.240.0030.03615.26
5.3.230.0030.04515.26
5.3.220.0070.04615.26
5.3.210.0030.07615.26
5.3.200.0000.04115.26
5.3.190.0230.04615.26
5.3.180.0100.04515.26
5.3.170.0000.04515.26
5.3.160.0170.04815.26
5.3.150.0040.03515.26
5.3.140.0000.04515.26
5.3.130.0000.04215.26
5.3.120.0000.04115.26
5.3.110.0070.03615.26
5.3.100.0070.03515.26
5.3.90.0100.04115.26
5.3.80.0030.04415.26
5.3.70.0060.03215.26
5.3.60.0030.03815.26
5.3.50.0060.03615.26
5.3.40.0000.03915.26
5.3.30.0000.04515.26
5.3.20.0000.04115.26
5.3.10.0070.02915.26
5.3.00.0060.04415.26
5.2.170.0200.04015.26
5.2.160.0030.03915.26
5.2.150.0000.03015.26
5.2.140.0070.04615.26
5.2.130.0030.02815.26
5.2.120.0030.02715.26
5.2.110.0030.03015.26
5.2.100.0270.02715.26
5.2.90.0030.03015.26
5.2.80.0000.03115.26
5.2.70.0030.06115.26
5.2.60.0030.02815.26
5.2.50.0000.03115.26
5.2.40.0000.03015.26
5.2.30.0030.04315.26
5.2.20.0030.02715.26
5.2.10.0030.03615.26
5.2.00.0070.05715.26
5.1.60.0030.03915.26
5.1.50.0000.02615.26
5.1.40.0030.02215.26
5.1.30.0000.02815.26
5.1.20.0030.02615.26
5.1.10.0060.05515.26
5.1.00.0030.02615.26
5.0.50.0030.02015.26
5.0.40.0070.02115.26
5.0.30.0000.06415.26
5.0.20.0000.02215.26
5.0.10.0030.01915.26
5.0.00.0000.03215.26
4.4.90.0000.01715.26
4.4.80.0030.01615.26
4.4.70.0000.01615.26
4.4.60.0040.02815.26
4.4.50.0030.03515.26
4.4.40.0000.04415.26
4.4.30.0070.02615.26
4.4.20.0060.02315.26
4.4.10.0030.01915.26
4.4.00.0000.02515.26
4.3.110.0000.01815.26
4.3.100.0060.01615.26
4.3.90.0000.01715.26
4.3.80.0000.02615.26
4.3.70.0030.01315.26
4.3.60.0000.01615.26
4.3.50.0030.02415.26
4.3.40.0000.02915.26
4.3.30.0000.01715.26
4.3.20.0000.01915.26
4.3.10.0030.01315.26
4.3.00.0000.04015.26

preferences:
44.73 ms | 401 KiB | 5 Q