3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'id_1_1' => 'id1', 'foo_1_2' => 'value1_1', 'bar_1_3' => 'value1_2', 'more_1_4' => 'value1_3', 'id_2_1' => 'id2', 'foo_2_2' => 'value2_1', 'bar_2_3' => 'value2_2', 'more_2_4' => 'value2_3' ]; function convert($a) { $map = [ ]; $result = []; foreach ($a as $array_key => $value) { list($newkey, $number) = explode('_', $array_key); if ($newkey === 'id') { $map[$number] = $value; $result[$value] = []; } elseif (key_exists($number, $map)) { $id = $map[$number]; $result[$id][$newkey] = $value; } } return $result; } $result = convert($array); var_export($result);

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.00718.29
8.3.50.0110.00317.98
8.3.40.0040.01118.98
8.3.30.0120.00318.68
8.3.20.0050.00319.33
8.3.10.0040.00421.73
8.3.00.0000.00823.68
8.2.180.0030.01316.50
8.2.170.0060.00922.96
8.2.160.0030.01019.26
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00419.76
8.2.120.0070.00026.35
8.2.110.0100.00021.06
8.2.100.0110.00017.72
8.2.90.0040.00419.41
8.2.80.0040.00417.97
8.2.70.0000.00817.93
8.2.60.0040.00418.04
8.2.50.0040.00418.10
8.2.40.0070.00419.43
8.2.30.0040.00419.21
8.2.20.0040.00418.14
8.2.10.0040.00419.53
8.2.00.0000.00819.43
8.1.280.0060.00925.92
8.1.270.0040.00420.43
8.1.260.0050.00326.35
8.1.250.0050.00328.09
8.1.240.0060.00323.97
8.1.230.0080.00420.97
8.1.220.0000.00817.77
8.1.210.0000.00818.77
8.1.200.0060.00317.36
8.1.190.0070.00317.25
8.1.180.0040.00418.10
8.1.170.0080.00018.88
8.1.160.0040.00418.97
8.1.150.0040.00418.79
8.1.140.0000.00819.48
8.1.130.0000.00717.54
8.1.120.0040.00417.55
8.1.110.0040.00417.41
8.1.100.0030.00417.53
8.1.90.0000.00817.43
8.1.80.0040.00417.36
8.1.70.0000.00717.38
8.1.60.0080.00017.68
8.1.50.0050.00317.60
8.1.40.0020.00517.55
8.1.30.0000.00917.57
8.1.20.0040.00417.58
8.1.10.0040.00417.49
8.1.00.0000.00817.51
8.0.300.0000.00719.98
8.0.290.0040.00416.75
8.0.280.0000.00718.55
8.0.270.0030.00317.29
8.0.260.0030.00316.89
8.0.250.0000.00716.95
8.0.240.0000.00716.91
8.0.230.0060.00316.97
8.0.220.0070.00016.93
8.0.210.0080.00016.91
8.0.200.0000.00617.00
8.0.190.0000.00816.99
8.0.180.0070.00016.96
8.0.170.0060.00316.84
8.0.160.0000.00816.94
8.0.150.0000.00716.84
8.0.140.0040.00416.76
8.0.130.0030.00313.30
8.0.120.0050.00216.90
8.0.110.0030.00616.88
8.0.100.0000.00716.80
8.0.90.0000.00716.71
8.0.80.0060.01016.92
8.0.70.0070.00016.79
8.0.60.0000.00816.98
8.0.50.0000.00916.80
8.0.30.0090.01017.18
8.0.20.0120.00817.40
8.0.10.0040.00416.94
8.0.00.0120.00916.77
7.4.330.0050.00015.55
7.4.320.0060.00016.55
7.4.300.0040.00416.51
7.4.290.0070.00316.52
7.4.280.0060.00316.51
7.4.270.0040.00416.54
7.4.260.0080.00316.42
7.4.250.0000.00816.48
7.4.240.0070.00016.51
7.4.230.0040.00416.53
7.4.220.0040.00416.47
7.4.210.0040.01316.50
7.4.200.0040.00416.63
7.4.160.0080.01216.44
7.4.140.0090.00917.86
7.4.130.0070.01116.58
7.4.120.0100.01016.49
7.4.110.0070.01016.64
7.4.100.0140.00316.69
7.4.90.0120.00816.47
7.4.80.0070.01019.39
7.4.70.0100.00616.58
7.4.60.0070.01016.55
7.4.50.0160.00316.34
7.4.40.0140.00616.68
7.4.00.0100.00314.85
7.3.330.0000.00513.40
7.3.320.0060.00013.16
7.3.310.0030.00316.43
7.3.300.0060.00016.19
7.3.290.0000.00716.36
7.3.280.0120.00516.41
7.3.260.0100.00816.48
7.3.240.0090.01116.40
7.3.230.0040.01316.51
7.3.210.0090.00916.43
7.3.200.0160.00016.48
7.3.190.0030.01216.56
7.3.180.0130.00316.65
7.3.170.0070.01516.48
7.3.160.0120.00916.51
7.3.10.0110.00316.64
7.3.00.0000.01216.66
7.2.330.0040.01316.69
7.2.320.0200.00316.77
7.2.310.0060.01216.82
7.2.300.0140.00616.67
7.2.290.0070.01316.59
7.2.130.0100.00316.83
7.2.120.0070.01016.85
7.2.110.0000.01316.98
7.2.100.0060.01017.02
7.2.90.0060.00616.89
7.2.80.0080.00416.58
7.2.70.0030.01316.94
7.2.60.0110.00516.70
7.2.50.0070.01116.88
7.2.40.0070.01117.05
7.2.30.0080.00916.93
7.2.20.0080.00916.79
7.2.10.0100.01016.83
7.2.00.0070.01116.94
7.1.250.0040.00715.82
7.1.240.0030.01315.89
7.1.230.0040.01115.48
7.1.220.0030.01015.84
7.1.210.0060.01115.68
7.1.200.0030.00915.72
7.1.190.0070.01015.61
7.1.180.0030.00615.93
7.1.170.0070.00815.83
7.1.160.0070.00915.74
7.1.150.0070.00615.69
7.1.140.0030.01415.70
7.1.130.0050.01215.71
7.1.120.0070.00615.66
7.1.110.0090.00715.63
7.1.100.0120.00315.79
7.1.90.0050.00815.79
7.1.80.0070.00715.89
7.1.70.0040.00915.57
7.1.60.0170.01224.56
7.1.50.0190.01024.57
7.1.40.0270.00324.68
7.1.30.0200.00624.79
7.1.20.0160.00924.81
7.1.10.0050.01015.76
7.1.00.0020.00915.61
7.0.330.0060.00615.54
5.6.380.0100.00314.41

preferences:
61.22 ms | 400 KiB | 5 Q