3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ ['mango', 'orange', 'apple'], ['abc'], ['ctp'], ['pqr', 'cst', 'dtc'], ['cbx'], ['xyz'], ['atc'], ]; foreach($data as $key => $d){ if(count($d)>1){ $mergeTo = $key; // store key where to merge to continue; // go to next item } $data[$mergeTo]["additional"][] = $d; // add value to $mergeTo unset($data[$key]); // unset the value from the main array } $data = array_values($data); // reset keys var_export($data);

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.4.10.0030.00619.58
8.3.140.0000.00818.95
8.3.130.0070.01316.46
8.3.120.0080.00018.86
8.3.110.0130.00320.94
8.3.100.0060.00316.84
8.3.90.0040.00426.77
8.3.80.0060.00616.63
8.3.70.0070.00716.58
8.3.60.0000.01518.43
8.3.50.0090.00617.53
8.3.40.0080.00818.84
8.3.30.0000.01418.86
8.3.20.0000.00720.67
8.3.10.0040.00420.40
8.3.00.0050.00320.73
8.2.260.0070.00716.57
8.2.250.0080.00018.27
8.2.240.0030.00619.10
8.2.230.0000.00922.58
8.2.220.0090.00924.06
8.2.210.0130.00626.77
8.2.200.0040.00416.63
8.2.190.0110.00416.63
8.2.180.0100.01018.41
8.2.170.0150.00022.96
8.2.160.0070.00720.87
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0000.00720.96
8.2.110.0060.00321.05
8.2.100.0110.00017.85
8.2.90.0000.00817.97
8.2.80.0000.00817.97
8.2.70.0030.01017.50
8.2.60.0090.00017.93
8.2.50.0040.00418.07
8.2.40.0050.00318.16
8.2.30.0070.00018.00
8.2.20.0030.00518.02
8.2.10.0000.00719.43
8.2.00.0070.00018.11
8.1.310.0050.00318.40
8.1.300.0030.00618.06
8.1.290.0000.00930.84
8.1.280.0060.00925.92
8.1.270.0040.00420.42
8.1.260.0030.00626.35
8.1.250.0080.00028.09
8.1.240.0060.00322.14
8.1.230.0080.00321.04
8.1.220.0000.00917.79
8.1.210.0080.00019.94
8.1.200.0060.00317.35
8.1.190.0030.00619.13
8.1.180.0040.00418.10
8.1.170.0030.00518.80
8.1.160.0070.00018.95
8.1.150.0000.00718.89
8.1.140.0000.00720.14
8.1.130.0000.00720.21
8.1.120.0040.00417.40
8.1.110.0000.00717.38
8.1.100.0000.00717.38
8.1.90.0020.00517.45
8.1.80.0040.00417.33
8.1.70.0070.00317.46
8.1.60.0060.00317.63
8.1.50.0040.00417.56
8.1.40.0030.00817.56
8.1.30.0040.00417.55
8.1.20.0050.00317.71
8.1.10.0070.00017.50
8.1.00.0000.00717.40
8.0.300.0070.00020.20
8.0.290.0020.00516.63
8.0.280.0040.00418.44
8.0.270.0000.00717.25
8.0.260.0050.00218.36
8.0.250.0000.00716.97
8.0.240.0040.00416.91
8.0.230.0030.00316.89
8.0.220.0040.00816.90
8.0.210.0040.00416.78
8.0.200.0030.00316.95
8.0.190.0000.00916.93
8.0.180.0000.00716.93
8.0.170.0040.00416.97
8.0.160.0040.00416.85
8.0.150.0040.00416.82
8.0.140.0030.00316.87
8.0.130.0060.00013.30
8.0.120.0040.00416.89
8.0.110.0040.00416.82
8.0.100.0080.00016.80
8.0.90.0040.00416.83
8.0.80.0090.00616.90
8.0.70.0040.00416.74
8.0.60.0040.00416.73
8.0.50.0040.00416.91
8.0.30.0170.00316.93
8.0.20.0060.01617.40
8.0.10.0040.00417.13
8.0.00.0120.00716.74
7.4.330.0000.00516.85
7.4.320.0030.00316.61
7.4.300.0000.00616.65
7.4.290.0040.00416.59
7.4.280.0000.00816.57
7.4.270.0030.00316.50
7.4.260.0000.00816.35
7.4.250.0050.00316.46
7.4.240.0000.00816.63
7.4.230.0000.00716.57
7.4.220.0030.00516.71
7.4.210.0070.00816.64
7.4.200.0020.00516.30
7.4.160.0090.00716.51
7.4.140.0070.01117.86
7.4.130.0070.01016.63
7.4.120.0060.01316.54
7.4.110.0060.01216.57
7.4.100.0130.00916.38
7.4.90.0030.01416.31
7.4.80.0040.01419.39
7.4.70.0160.00416.56
7.4.60.0100.01016.43
7.4.50.0070.00716.62
7.4.40.0120.00616.32
7.4.00.0070.01015.08
7.3.330.0030.00313.27
7.3.320.0070.00013.07
7.3.310.0070.00016.15
7.3.300.0030.00316.33
7.3.290.0030.00316.44
7.3.280.0070.00816.39
7.3.260.0120.00716.35
7.3.240.0110.00916.41
7.3.230.0100.00816.47
7.3.210.0030.01316.52
7.3.200.0070.01416.54
7.3.190.0130.00916.43
7.3.180.0200.00016.43
7.3.170.0130.00716.55
7.3.160.0090.01316.37
7.3.120.0080.00814.80
7.3.110.0100.00615.01
7.3.100.0100.00714.57
7.3.90.0130.00314.93
7.3.80.0030.00614.84
7.3.70.0030.01314.68
7.3.60.0060.00914.52
7.3.50.0040.00814.92
7.3.40.0130.00014.64
7.3.30.0070.00714.78
7.3.20.0520.00715.73
7.3.10.0740.00815.90
7.3.00.0600.00315.72
7.2.330.0100.00716.52
7.2.320.0030.01716.86
7.2.310.0180.00316.52
7.2.300.0090.00616.52
7.2.290.0100.00716.70
7.2.250.0060.01215.20
7.2.240.0170.00315.08
7.2.230.0060.00614.86
7.2.220.0070.01014.68
7.2.210.0060.00615.16
7.2.200.0060.01015.14
7.2.190.0060.00615.15
7.2.180.0030.01014.91
7.2.170.0030.01015.16
7.2.150.1240.01014.95
7.2.140.1080.00315.18
7.2.130.1210.01014.98
7.2.120.1310.01015.23
7.2.110.1510.00715.26
7.2.100.1570.00915.10
7.2.90.1050.00715.29
7.2.80.0910.00414.99
7.2.70.0790.00315.05
7.2.60.0750.00715.25
7.2.50.0750.00615.29
7.2.40.0730.01014.90
7.2.30.0960.01014.96
7.2.20.0890.00715.11
7.2.10.0930.01015.17
7.2.00.0950.00315.27
7.1.330.0050.00816.00
7.1.320.0070.00415.61
7.1.310.0090.00315.69
7.1.300.0030.00715.77
7.1.290.0080.00315.75
7.1.280.0090.00315.50
7.1.270.0060.00315.74
7.1.260.0030.01015.90
7.1.250.1250.00314.06

preferences:
28.51 ms | 403 KiB | 5 Q