3v4l.org

run code in 300+ PHP versions simultaneously
<?php $comments = [ 1 => ['content' => "The first comment", 'parent' => 0], 2 => ['content' => "The second comment", 'parent' => 0], 3 => ['content' => "Reply of first comment", 'parent' => 1], 4 => ['content' => "Another reply of first comemnt", 'parent' => 1], 5 => ['content' => "Reply of a reply of the first comment", 'parent' => 4] ]; foreach($comments as $id => &$c) { if (isset($comments[$c['parent']])) { $comments[$c['parent']]['comments'][$id] =& $c; unset($comments[$id]); } } var_dump($comments);

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.0150.00616.75
8.3.50.0090.01221.19
8.3.40.0090.00618.45
8.3.30.0150.00018.90
8.3.20.0060.01320.38
8.3.10.0000.00821.73
8.3.00.0000.00819.56
8.2.180.0090.00616.50
8.2.170.0070.01022.96
8.2.160.0100.00320.52
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0110.00726.16
8.2.120.0070.00019.67
8.2.110.0090.00019.26
8.2.100.0090.00317.73
8.2.90.0060.00319.17
8.2.80.0060.00317.97
8.2.70.0060.00317.63
8.2.60.0030.00618.03
8.2.50.0160.00018.07
8.2.40.0060.00321.01
8.2.30.0070.00018.12
8.2.20.0040.00417.78
8.2.10.0060.00318.06
8.2.00.0040.00418.11
8.1.280.0090.00625.92
8.1.270.0060.00320.24
8.1.260.0080.00026.35
8.1.250.0060.00328.09
8.1.240.0030.00623.98
8.1.230.0040.00817.57
8.1.220.0060.00317.76
8.1.210.0080.00018.77
8.1.200.0100.00017.36
8.1.190.0060.00317.35
8.1.180.0040.00418.10
8.1.170.0050.00518.65
8.1.160.0030.00522.03
8.1.150.0000.00818.88
8.1.140.0030.00517.39
8.1.130.0030.00317.69
8.1.120.0070.00017.35
8.1.110.0060.00317.43
8.1.100.0050.00317.50
8.1.90.0030.00517.43
8.1.80.0000.00717.44
8.1.70.0000.00717.49
8.1.60.0040.00417.60
8.1.50.0000.00817.54
8.1.40.0070.00417.39
8.1.30.0000.00917.51
8.1.20.0020.00517.48
8.1.10.0040.00417.41
8.1.00.0040.00417.50
8.0.300.0070.00018.77
8.0.290.0000.00816.63
8.0.280.0070.00018.44
8.0.270.0040.00417.32
8.0.260.0070.00317.25
8.0.250.0050.00216.87
8.0.240.0020.00917.01
8.0.230.0070.00016.88
8.0.220.0040.00416.81
8.0.210.0080.00016.88
8.0.200.0000.00816.99
8.0.190.0040.00417.00
8.0.180.0070.00316.95
8.0.170.0040.00416.86
8.0.160.0060.00316.92
8.0.150.0000.00816.91
8.0.140.0030.00316.91
8.0.130.0030.00313.30
8.0.120.0090.00016.86
8.0.110.0040.00416.81
8.0.100.0040.00417.00
8.0.90.0070.00016.75
8.0.80.0110.00516.88
8.0.70.0050.00316.84
8.0.60.0050.00216.94
8.0.50.0050.00316.95
8.0.30.0070.00917.17
8.0.20.0170.00617.40
8.0.10.0000.00816.91
8.0.00.0130.00816.77
7.4.330.0050.00015.08
7.4.320.0000.00616.50
7.4.300.0030.00316.48
7.4.290.0030.00316.59
7.4.280.0000.00816.49
7.4.270.0030.00316.56
7.4.260.0040.00416.54
7.4.250.0090.00016.46
7.4.240.0030.00516.45
7.4.230.0000.00716.39
7.4.220.0030.01616.54
7.4.210.0020.01516.54
7.4.200.0030.00316.65
7.4.160.0150.00916.49
7.4.150.0190.00517.40
7.4.140.0110.01117.86
7.4.130.0100.00716.48
7.4.120.0060.01216.47
7.4.110.0060.01316.52
7.4.100.0090.00916.45
7.4.90.0090.01716.48
7.4.80.0120.00619.39
7.4.70.0090.01116.25
7.4.60.0060.00916.58
7.4.50.0000.00516.65
7.4.40.0060.01016.43
7.4.30.0090.01316.55
7.4.00.0070.00715.01
7.3.330.0050.00413.23
7.3.320.0000.00513.23
7.3.310.0040.00416.22
7.3.300.0030.00316.32
7.3.290.0030.00316.25
7.3.280.0090.00816.31
7.3.270.0030.01417.40
7.3.260.0090.00916.30
7.3.250.0120.00816.38
7.3.240.0160.00616.61
7.3.230.0120.00616.51
7.3.210.0120.00616.44
7.3.200.0110.00619.39
7.3.190.0110.00616.64
7.3.180.0130.00316.36
7.3.170.0060.01116.43
7.3.160.0070.01116.36
7.2.330.0120.00816.72
7.2.320.0140.01016.64
7.2.310.0110.00716.75
7.2.300.0080.00816.46
7.2.290.0070.01516.48
7.2.00.0030.01219.54
7.1.100.1040.00316.57
7.1.70.0000.00717.20
7.1.60.0130.01320.03
7.1.50.0240.00734.93
7.1.00.0000.07722.51
7.0.200.0040.00816.53
7.0.60.0070.04319.91
7.0.50.0100.06717.80
7.0.40.0070.05720.23
7.0.30.0530.07720.14
7.0.20.0270.07720.16
7.0.10.0100.07020.16
7.0.00.0130.08020.30
5.6.280.0030.05321.09
5.6.210.0100.07720.74
5.6.200.0000.04718.13
5.6.190.0070.05320.61
5.6.180.3100.05020.57
5.6.170.0230.06720.44
5.6.160.0070.06020.41
5.6.150.0170.06318.12
5.6.140.0070.05718.11
5.6.130.0070.06718.08
5.6.120.0100.03721.09
5.6.110.0100.08021.01
5.6.100.0070.03720.97
5.6.90.0130.07320.98
5.6.80.0070.04320.28
5.6.70.3130.04320.39
5.5.350.0000.08320.29
5.5.340.0030.04017.88
5.5.330.0100.04720.25
5.5.320.0270.07320.24
5.5.310.0300.07020.23
5.5.300.0070.05718.02
5.5.290.0030.07017.97
5.5.280.0070.05320.80
5.5.270.0170.06020.64
5.5.260.0130.08020.76
5.5.250.0100.07720.70
5.5.240.0200.08320.15
5.4.450.0100.05719.14
5.4.440.0270.04719.48
5.4.430.0170.08019.60
5.4.420.0130.06719.48
5.4.410.0200.04719.32
5.4.400.0200.04718.78
5.4.390.0100.05719.15
5.4.380.0170.04719.31
5.4.370.0170.05018.95
5.4.360.0070.06019.25
5.4.350.0100.05318.81
5.4.340.0230.04719.28
5.4.320.0100.06318.95
5.4.310.0130.05019.25
5.4.300.0200.05018.95
5.4.290.0170.05319.28
5.4.280.0230.04318.95
5.4.270.0070.05719.09
5.4.260.0100.05018.94
5.4.250.0100.05718.92
5.4.240.0200.04719.13
5.4.230.0300.04019.01
5.4.220.0070.06019.30
5.4.210.0100.05319.08
5.4.200.0100.05016.65
5.4.190.0100.05718.81
5.4.180.0170.05019.28
5.4.170.0200.04719.28
5.4.160.0070.05719.27
5.4.150.0200.04318.85
5.4.140.0170.05016.51
5.4.130.0100.05316.25
5.4.120.0200.04316.60
5.4.110.0070.05316.44
5.4.100.0130.05016.34
5.4.90.0070.05716.25
5.4.80.0170.04716.35
5.4.70.0170.04716.27
5.4.60.0100.05016.34
5.4.50.0070.05316.23
5.4.40.0200.04316.29
5.4.30.0100.05016.55
5.4.20.0200.06016.43
5.4.10.0170.05316.18
5.4.00.0070.05715.73

preferences:
53.27 ms | 401 KiB | 5 Q