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 ($array) { unset($array['id']); return $array['label']; }, $array ); 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.0180.00416.75
8.3.50.0150.00522.00
8.3.40.0040.01418.82
8.3.30.0070.00718.66
8.3.20.0040.00419.04
8.3.10.0080.00821.82
8.3.00.0050.00319.11
8.2.180.0070.00716.49
8.2.170.0040.01122.96
8.2.160.0140.00020.69
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00417.80
8.2.120.0000.00726.35
8.2.110.0000.00819.38
8.2.100.0130.00018.05
8.2.90.0050.00319.22
8.2.80.0000.00817.97
8.2.70.0030.00617.75
8.2.60.0080.00017.93
8.2.50.0030.00618.09
8.2.40.0110.00020.43
8.2.30.0040.00419.46
8.2.20.0000.00717.77
8.2.10.0080.00018.03
8.2.00.0000.00718.05
8.1.280.0140.00425.92
8.1.270.0050.00323.84
8.1.260.0000.00828.09
8.1.250.0040.00428.09
8.1.240.0090.00022.57
8.1.230.0000.01117.76
8.1.220.0080.00017.88
8.1.210.0000.00818.77
8.1.200.0000.00917.47
8.1.190.0000.00817.38
8.1.180.0060.00318.10
8.1.170.0080.00018.64
8.1.160.0030.00520.69
8.1.150.0030.00620.63
8.1.140.0030.00519.47
8.1.130.0040.00417.78
8.1.120.0040.00417.38
8.1.110.0040.00417.49
8.1.100.0070.00017.38
8.1.90.0030.00617.51
8.1.80.0040.00417.51
8.1.70.0070.00017.47
8.1.60.0000.00717.49
8.1.50.0000.00817.37
8.1.40.0080.00017.43
8.1.30.0040.00417.65
8.1.20.0080.00017.68
8.1.10.0090.00017.37
8.1.00.0050.00517.35
8.0.300.0000.00918.77
8.0.290.0000.00716.75
8.0.280.0070.00018.45
8.0.270.0000.00817.21
8.0.260.0000.00717.16
8.0.250.0070.00016.94
8.0.240.0000.00617.03
8.0.230.0030.00316.98
8.0.220.0030.00316.87
8.0.210.0000.00716.93
8.0.200.0030.00517.02
8.0.190.0060.00316.95
8.0.180.0050.00316.87
8.0.170.0040.00416.92
8.0.160.0000.00817.01
8.0.150.0040.00416.82
8.0.140.0070.00016.87
8.0.130.0050.00013.41
8.0.120.0030.00616.79
8.0.110.0040.00416.82
8.0.100.0000.00716.75
8.0.90.0000.00716.85
8.0.80.0060.01016.93
8.0.70.0040.00416.84
8.0.60.0000.00716.95
8.0.50.0020.00516.78
8.0.30.0070.01217.11
8.0.20.0130.00917.40
8.0.10.0040.00416.89
8.0.00.0070.01116.79
7.4.330.0030.00315.08
7.4.320.0030.00316.43
7.4.300.0030.00316.46
7.4.290.0000.00816.65
7.4.280.0000.00716.60
7.4.270.0040.00316.64
7.4.260.0040.00416.60
7.4.250.0000.00816.35
7.4.240.0000.00816.46
7.4.230.0030.00316.60
7.4.220.0130.00416.64
7.4.210.0110.00416.54
7.4.200.0000.00716.61
7.4.160.0120.00816.66
7.4.150.0150.00917.40
7.4.140.0070.01417.86
7.4.130.0120.00516.52
7.4.120.0120.00616.61
7.4.110.0090.00916.35
7.4.100.0160.00016.45
7.4.90.0130.00916.60
7.4.80.0120.00619.39
7.4.70.0080.00816.48
7.4.60.0080.00816.55
7.4.50.0090.00616.39
7.4.40.0080.00816.55
7.4.30.0070.01116.70
7.4.00.0000.01614.98
7.3.330.0000.00513.15
7.3.320.0000.00513.23
7.3.310.0070.00016.24
7.3.300.0070.00016.37
7.3.290.0000.00716.20
7.3.280.0060.01016.36
7.3.270.0050.01517.40
7.3.260.0030.01416.46
7.3.250.0120.00616.39
7.3.240.0110.00816.43
7.3.230.0070.01016.63
7.3.210.0100.00616.64
7.3.200.0080.00816.59
7.3.190.0090.00916.40
7.3.180.0100.01016.46
7.3.170.0140.00416.61
7.3.160.0000.01716.62
7.3.10.0050.00716.43
7.3.00.0070.00816.69
7.2.330.0110.00616.79
7.2.320.0090.00816.80
7.2.310.0210.02416.64
7.2.300.0100.00716.69
7.2.290.0070.01116.65
7.2.130.0030.01017.05
7.2.120.0050.00717.06
7.2.110.0050.00616.94
7.2.100.0050.00517.05
7.2.90.0050.00816.93
7.2.80.0040.00516.93
7.2.70.0050.00617.07
7.2.60.0040.01117.08
7.2.50.0050.00716.99
7.2.40.0050.00716.77
7.2.30.0050.00716.78
7.2.20.0060.00416.87
7.2.10.0070.00717.02
7.2.00.0020.01416.91
7.1.250.0030.00915.63
7.1.200.0060.00315.66
7.1.70.0000.00716.93
7.1.60.0160.01619.85
7.1.00.0000.08022.40
7.0.200.0660.00714.51
7.0.60.0100.06019.98
7.0.50.0270.04720.45
7.0.40.0230.05320.32
7.0.30.0200.05320.32
7.0.20.0370.05320.30
7.0.10.0330.06020.25
7.0.00.0200.06020.26
5.6.280.0030.07321.13
5.6.210.0100.05720.70
5.6.200.0200.06321.07
5.6.190.0170.05721.08
5.6.180.0070.06721.12
5.6.170.0170.06021.07
5.6.160.0130.06021.21
5.6.150.0300.04321.26
5.6.140.0200.05021.12
5.6.130.0300.06021.20
5.6.120.0200.05021.20
5.6.110.0300.05321.20
5.6.100.0500.05021.02
5.6.90.0430.06020.99
5.6.80.0300.06720.44
5.6.70.0570.05320.54
5.6.60.0470.05720.56
5.6.50.0370.06320.50
5.6.40.0400.05020.56
5.6.30.0330.05720.57
5.6.20.0300.06020.39
5.6.10.0400.05320.41
5.6.00.0370.05720.38
5.5.350.0130.06020.44
5.5.340.0230.07720.72
5.5.330.0170.05320.76
5.5.320.0330.04720.72
5.5.310.0230.05320.86
5.5.300.0130.05720.83
5.5.290.0200.06020.86
5.5.280.0070.07320.95
5.5.270.0530.06721.03
5.5.260.0470.05320.82
5.5.250.0570.05320.52
5.5.240.0530.05320.33
5.5.230.0470.05720.23
5.5.220.0500.05020.29
5.5.210.0500.05020.40
5.5.200.0330.06020.22
5.5.190.0330.06320.35
5.5.180.0470.05720.22
5.5.160.0530.06020.20
5.5.150.0300.06020.34
5.5.140.0370.05020.39
5.5.130.0330.05720.39
5.5.120.0370.05020.21
5.5.110.0370.05320.05
5.5.100.0370.05320.14
5.5.90.0630.03720.07
5.5.80.0500.05020.11
5.5.70.0530.05720.00
5.5.60.0530.04720.04
5.5.50.0470.05319.95
5.5.40.0100.05320.16
5.5.30.0130.05020.15
5.5.20.0200.05720.09
5.5.10.0630.05020.17
5.5.00.0470.05320.13

preferences:
30.86 ms | 401 KiB | 5 Q