3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'de' => [ 'label' => 'German', 'id' => 912 ], 'cn' => [ 'label' => 'Chinese', 'id' => 913 ] ]; // Initial attempt $translations = array_map( function ($v) { return $v['label']; }, $input ); var_dump($translations); // Actual //[ // 0 => [ // 'de' => 'German' // ], // 1 => [ // 'cn' 'Chinese' // ] //] // Desired //[ // 'de' => 'German', // 'cn' => 'Chinese' //] // Works declaratively via the following... $newArray = []; foreach ($array as $key => $value) { $newArray[$key] = $value['label']; } var_dump($newArray);

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.0070.00716.63
8.3.50.0220.00017.98
8.3.40.0120.00319.00
8.3.30.0040.01118.66
8.3.20.0060.00319.21
8.3.10.0060.00321.92
8.3.00.0000.01020.95
8.2.180.0070.01418.39
8.2.170.0110.01122.96
8.2.160.0110.00422.31
8.2.150.0030.00624.18
8.2.140.0060.00324.66
8.2.130.0090.00017.90
8.2.120.0080.00026.35
8.2.110.0000.00921.14
8.2.100.0000.01117.90
8.2.90.0040.00419.05
8.2.80.0000.00817.97
8.2.70.0050.00317.63
8.2.60.0090.00617.68
8.2.50.0000.00818.09
8.2.40.0080.00020.42
8.2.30.0050.00519.46
8.2.20.0000.00817.70
8.2.10.0000.00818.14
8.2.00.0000.00818.13
8.1.280.0100.00325.92
8.1.270.0030.00623.76
8.1.260.0060.00328.09
8.1.250.0060.00328.09
8.1.240.0000.00922.43
8.1.230.0080.00417.77
8.1.220.0080.00017.79
8.1.210.0000.00718.77
8.1.200.0030.00617.35
8.1.190.0040.00417.23
8.1.180.0030.00618.10
8.1.170.0060.00318.65
8.1.160.0040.00420.78
8.1.150.0020.00518.90
8.1.140.0000.00819.54
8.1.130.0000.00717.73
8.1.120.0040.00417.53
8.1.110.0060.00317.37
8.1.100.0030.00517.48
8.1.90.0050.00317.46
8.1.80.0050.00217.53
8.1.70.0000.00717.48
8.1.60.0080.00017.49
8.1.50.0000.00817.45
8.1.40.0000.01317.46
8.1.30.0000.00917.67
8.1.20.0040.00417.73
8.1.10.0040.00417.48
8.1.00.0070.00417.58
8.0.300.0050.00318.77
8.0.290.0000.00816.63
8.0.280.0040.00418.26
8.0.270.0050.00217.22
8.0.260.0030.00318.38
8.0.250.0030.00316.94
8.0.240.0070.00016.89
8.0.230.0000.00716.87
8.0.220.0070.00016.77
8.0.210.0040.00416.80
8.0.200.0000.00817.03
8.0.190.0050.00316.93
8.0.180.0040.00416.92
8.0.170.0040.00416.98
8.0.160.0020.00516.99
8.0.150.0020.00516.91
8.0.140.0060.00316.93
8.0.130.0030.00313.47
8.0.120.0040.00417.01
8.0.110.0050.00317.03
8.0.100.0000.00717.03
8.0.90.0040.00416.82
8.0.80.0090.00616.96
8.0.70.0000.00816.90
8.0.60.0040.00417.03
8.0.50.0050.00316.84
8.0.30.0110.00617.09
8.0.20.0120.00817.40
8.0.10.0000.00717.09
8.0.00.0110.00616.75
7.4.330.0040.00416.70
7.4.320.0000.00716.65
7.4.300.0000.00616.50
7.4.290.0000.00716.51
7.4.280.0000.00816.43
7.4.270.0040.00416.51
7.4.260.0040.00416.46
7.4.250.0070.00016.42
7.4.240.0040.00416.56
7.4.230.0070.00016.68
7.4.220.0060.01316.40
7.4.210.0070.00716.56
7.4.200.0030.00516.50
7.4.160.0140.00716.40
7.4.150.0110.00617.40
7.4.140.0100.00717.86
7.4.130.0070.01016.55
7.4.120.0070.00916.54
7.4.110.0120.00416.47
7.4.100.0040.01516.50
7.4.90.0100.01016.70
7.4.80.0110.00719.39
7.4.70.0060.01016.41
7.4.60.0130.00516.34
7.4.50.0030.01016.58
7.4.40.0120.00616.64
7.4.30.0100.00716.57
7.4.00.0070.00314.82
7.3.330.0060.00013.38
7.3.320.0030.00313.44
7.3.310.0000.00816.53
7.3.300.0000.00716.47
7.3.290.0100.00716.42
7.3.280.0120.00716.43
7.3.270.0040.01317.40
7.3.260.0110.00816.44
7.3.250.0100.00716.56
7.3.240.0100.00816.51
7.3.230.0070.01416.45
7.3.210.0130.00316.41
7.3.200.0120.00616.65
7.3.190.0060.01316.51
7.3.180.0070.01016.45
7.3.170.0070.01016.67
7.3.160.0060.01216.40
7.2.330.0060.01216.73
7.2.320.0100.00716.76
7.2.310.0150.00316.52
7.2.300.0070.01016.80
7.2.290.0070.01416.79
7.2.60.0070.00716.97
7.2.00.0060.00619.05
7.1.200.0080.00815.71
7.1.100.0030.01217.84
7.1.70.0050.00517.32
7.1.60.0070.01119.85
7.1.50.0140.01416.87
7.1.00.0030.07722.36
7.0.200.0040.01114.85
7.0.60.0730.00020.00
7.0.50.1100.00020.31
7.0.40.1600.00020.29
7.0.30.1000.00020.29
7.0.20.1300.00020.23
7.0.10.1370.00020.32
7.0.00.1200.00020.21
5.6.280.0030.07321.00
5.6.210.0830.00020.74
5.6.200.1100.00021.16
5.6.190.1000.00021.13
5.6.180.1170.00021.18
5.6.170.1130.00021.08
5.6.160.1030.00021.05
5.6.150.1030.00021.20
5.6.140.1370.00021.04
5.6.130.1500.00021.03
5.6.120.0970.00021.12
5.6.110.1000.00021.00
5.6.100.0970.00021.14
5.6.90.1000.00021.04
5.6.80.0870.00020.54
5.6.70.0870.00020.45
5.6.60.1070.00020.39
5.6.50.1030.00020.45
5.6.40.0800.00020.43
5.6.30.1100.00020.57
5.6.20.1030.00020.40
5.6.10.1000.00020.37
5.6.00.0870.00020.35
5.5.350.0830.00020.43
5.5.340.1030.00020.80
5.5.330.1170.00020.72
5.5.320.0900.00021.00
5.5.310.1230.00020.87
5.5.300.1400.00020.75
5.5.290.1000.00020.80
5.5.280.1170.00020.80
5.5.270.0970.00020.82
5.5.260.0870.00020.86
5.5.250.1070.00020.85
5.5.240.0930.00020.25
5.5.230.1100.00020.21
5.5.220.1070.00020.37
5.5.210.1030.00020.21
5.5.200.0800.00020.17
5.5.190.1070.00020.22
5.5.180.1030.00020.12
5.5.160.0930.00020.21
5.5.150.0700.00020.34
5.5.140.0730.00020.29
5.5.130.1170.00020.38
5.5.120.1170.00020.21
5.5.110.1100.00020.19
5.5.100.1070.00020.18
5.5.90.1030.00020.07
5.5.80.0970.00020.06
5.5.70.1070.00020.10
5.5.60.1000.00020.06
5.5.50.0930.00020.08
5.5.40.0900.00020.05
5.5.30.0870.00020.25
5.5.20.0770.00020.07
5.5.10.0770.00020.11
5.5.00.0930.00020.20

preferences:
51.54 ms | 401 KiB | 5 Q