3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* assuming top level pid = 0 */$rows = array ( array ( 'id' => 1, 'pid' => 0 ), array ( 'id' => 2, 'pid' => 1 ), array ( 'id' => 3, 'pid' => 2 ), array ( 'id' => 4, 'pid' => 0 ), array ( 'id' => 5, 'pid' => 4 ), /* ... */);$rows = array_column ( $rows, null, 'id' );foreach ( $rows as $key => $val ) { if ( $val ['pid'] ) { if ( isset ( $rows [$val ['pid']] )) { $rows [$val ['pid']]['children'][] = &$rows [$key]; } }}foreach ( $rows as $key => $val ) { if ( $val ['pid'] ) unset ( $rows [$key] );}var_dump ( $rows );

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.40.0110.00418.79
8.3.30.0070.00718.98
8.3.20.0080.00020.33
8.3.10.0080.00023.52
8.3.00.0030.00517.50
8.2.170.0100.00522.96
8.2.160.0030.01520.58
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0140.00326.16
8.2.120.0040.00421.09
8.2.110.0090.00022.01
8.2.100.0090.00617.72
8.2.90.0040.00419.40
8.2.80.0040.00417.97
8.2.70.0040.00417.50
8.2.60.0030.00618.05
8.2.50.0030.00618.07
8.2.40.0000.00817.91
8.2.30.0030.00618.15
8.2.20.0000.00717.74
8.2.10.0000.00718.12
8.2.00.0040.00417.63
8.1.270.0080.00023.84
8.1.260.0050.00226.35
8.1.250.0040.00428.09
8.1.240.0060.00323.96
8.1.230.0070.00319.16
8.1.220.0000.00917.74
8.1.210.0050.00318.77
8.1.200.0030.00717.23
8.1.190.0050.00317.25
8.1.180.0090.00018.10
8.1.170.0000.00818.66
8.1.160.0000.00722.02
8.1.150.0000.00818.85
8.1.140.0030.00517.45
8.1.130.0000.00717.73
8.1.120.0000.00717.44
8.1.110.0040.00417.48
8.1.100.0000.00817.35
8.1.90.0070.00017.37
8.1.80.0070.00017.36
8.1.70.0000.00717.46
8.1.60.0070.00417.48
8.1.50.0040.00417.39
8.1.40.0040.00417.51
8.1.30.0040.00417.61
8.1.20.0070.00017.66
8.1.10.0030.00617.66
8.1.00.0080.00017.39
8.0.300.0040.00418.77
8.0.290.0000.00716.75
8.0.280.0030.00318.36
8.0.270.0050.00316.86
8.0.260.0080.00017.29
8.0.250.0000.00716.88
8.0.240.0000.00716.96
8.0.230.0030.00316.94
8.0.220.0000.00716.83
8.0.210.0000.00716.88
8.0.200.0040.00416.95
8.0.190.0000.00816.85
8.0.180.0040.00416.81
8.0.170.0000.00716.84
8.0.160.0000.00816.88
8.0.150.0000.00816.81
8.0.140.0000.01016.88
8.0.130.0080.00013.34
8.0.120.0050.00316.87
8.0.110.0080.00016.94
8.0.100.0040.00416.85
8.0.90.0040.00416.77
8.0.80.0070.00716.86
8.0.70.0050.00216.96
8.0.60.0000.00716.81
8.0.50.0000.00716.86
8.0.30.0180.00316.90
8.0.20.0180.00817.40
8.0.10.0050.00316.92
8.0.00.0140.00916.82
7.4.330.0000.00515.00
7.4.320.0050.00316.37
7.4.300.0060.00016.43
7.4.290.0000.00816.50
7.4.280.0000.00916.42
7.4.270.0030.00316.50
7.4.260.0070.00016.48
7.4.250.0050.00216.40
7.4.240.0050.00316.59
7.4.230.0080.00016.30
7.4.220.0060.01316.67
7.4.210.0130.00716.55
7.4.200.0030.00516.68
7.4.160.0120.00416.64
7.4.150.0120.00617.40
7.4.140.0080.01317.86
7.4.130.0130.00616.63
7.4.120.0060.01216.54
7.4.110.0100.00716.50
7.4.100.0200.00716.64
7.4.90.0100.00716.66
7.4.80.0090.01219.39
7.4.70.0090.01316.53
7.4.60.0110.00716.48
7.4.50.0050.00316.57
7.4.40.0000.01816.44
7.4.30.0060.01316.66
7.4.00.0030.00914.88
7.3.330.0050.00013.02
7.3.320.0000.00613.22
7.3.310.0070.00016.30
7.3.300.0070.00016.28
7.3.290.0110.00716.30
7.3.280.0100.00716.30
7.3.270.0090.00917.40
7.3.260.0170.00016.46
7.3.240.0030.01416.73
7.3.230.0030.01816.55
7.3.210.0090.00916.43
7.3.200.0090.01219.39
7.3.190.0040.01816.30
7.3.180.0060.01416.37
7.3.170.0040.01316.33
7.3.160.0070.01016.26
7.2.330.0160.00616.50
7.2.320.0060.01516.80
7.2.310.0170.00316.74
7.2.300.0110.01016.62
7.2.290.0100.00716.50
7.2.60.0040.01116.73
7.2.00.0170.00019.50
7.1.200.0030.00715.80
7.1.100.0030.00718.04
7.1.70.0060.00617.24
7.1.60.0100.01319.40
7.1.50.0200.01734.72
7.1.00.0030.07722.28
7.0.200.0110.00016.68
7.0.140.0000.08022.09
7.0.60.0000.04319.94
7.0.50.0100.03717.80
7.0.40.0100.03720.09
7.0.30.0170.04320.17
7.0.20.0370.06020.28
7.0.10.0030.04320.19
7.0.00.0170.07020.04
5.6.280.0030.07321.02
5.6.210.0100.06020.60
5.6.200.0100.04018.19
5.6.190.0070.06020.60
5.6.180.0300.08020.39
5.6.170.0230.07720.38
5.6.160.0070.06020.49
5.6.150.0100.03318.09
5.6.140.0030.06018.17
5.6.130.0070.07318.16
5.6.120.0070.03721.09
5.6.110.0170.07320.96
5.6.100.0100.03320.98
5.6.90.0100.04021.11
5.6.80.0070.05720.37
5.5.350.4170.04020.32
5.5.340.0100.07717.88
5.5.330.0000.05320.23
5.5.320.0230.07320.27
5.5.310.0430.06320.20
5.5.300.0070.07017.89
5.5.290.0070.07317.96
5.5.280.0070.08020.76
5.5.270.0070.07020.79
5.5.260.0030.06020.86
5.5.250.0030.04020.58
5.5.240.0000.08020.27
5.4.450.0930.07019.13
5.4.440.0870.06019.29
5.4.430.0600.05719.48
5.4.420.0730.05719.29
5.4.410.0770.05319.16
5.4.400.0870.05319.23
5.4.390.0730.05018.84
5.4.380.0200.05018.66
5.4.370.0170.03718.51
5.4.360.0070.04318.70
5.4.350.0050.03711.97
5.4.340.0100.05511.97
5.4.320.0110.04012.46
5.4.310.0090.03412.45
5.4.300.0050.03712.45
5.4.290.0040.03912.45
5.4.280.0080.04012.35
5.4.270.0060.03512.35
5.4.260.0050.04112.35
5.4.250.0060.03712.35
5.4.240.0070.03412.35
5.4.230.0060.03712.34
5.4.220.0060.03512.34
5.4.210.0080.03312.34
5.4.200.0070.03912.34
5.4.190.0060.04312.34
5.4.180.0060.05112.34
5.4.170.0060.03612.35
5.4.160.0030.03912.35
5.4.150.0040.03712.34
5.4.140.0090.03412.03
5.4.130.0030.04712.02
5.4.120.0040.03611.97
5.4.110.0040.03711.97
5.4.100.0050.04011.97
5.4.90.0040.04011.97
5.4.80.0060.03811.97
5.4.70.0060.03811.96
5.4.60.0050.03711.96
5.4.50.0090.03411.96
5.4.40.0050.03611.95
5.4.30.0080.04111.95
5.4.20.0070.03311.95
5.4.10.0050.03711.95
5.4.00.0060.04111.44
5.3.290.0090.03912.80
5.3.280.0070.03812.71
5.3.270.0040.04012.73
5.3.260.0050.04012.72
5.3.250.0070.03512.72
5.3.240.0060.03912.72
5.3.230.0080.03512.71
5.3.220.0110.03712.68
5.3.210.0040.04112.68
5.3.200.0040.03812.68
5.3.190.0080.03512.68
5.3.180.0040.04112.67
5.3.170.0060.03912.66
5.3.160.0060.03612.67
5.3.150.0070.04312.67
5.3.140.0100.03812.66
5.3.130.0070.03912.66
5.3.120.0090.03512.65
5.3.110.0040.04012.65
5.3.100.0070.03512.12
5.3.90.0070.03912.09
5.3.80.0050.03612.07
5.3.70.0050.03612.07
5.3.60.0040.03712.06
5.3.50.0040.03712.00
5.3.40.0060.03612.00
5.3.30.0040.03711.95
5.3.20.0060.03411.73
5.3.10.0040.03711.70
5.3.00.0060.03511.68
5.2.170.0090.0319.19
5.2.160.0080.0349.19
5.2.150.0090.0279.18
5.2.140.0050.0339.18
5.2.130.0060.0279.14
5.2.120.0060.0289.15
5.2.110.0050.0299.15
5.2.100.0060.0339.14
5.2.90.0060.0299.15
5.2.80.0030.0439.14
5.2.70.0070.0359.14
5.2.60.0050.0319.09
5.2.50.0090.0329.06
5.2.40.0040.0299.04
5.2.30.0060.0289.02
5.2.20.0060.0279.00
5.2.10.0070.0308.93
5.2.00.0070.0268.79
5.1.60.0040.0358.07
5.1.50.0060.0248.07
5.1.40.0070.0218.05
5.1.30.0040.0368.39
5.1.20.0090.0328.43
5.1.10.0030.0328.14
5.1.00.0070.0268.14
5.0.50.0010.0236.63
5.0.40.0060.0186.49
5.0.30.0040.0366.30
5.0.20.0040.0226.28
5.0.10.0020.0306.26
5.0.00.0040.0376.24
4.4.90.0030.0154.77
4.4.80.0030.0164.75
4.4.70.0030.0214.75
4.4.60.0040.0204.75
4.4.50.0040.0184.77
4.4.40.0050.0234.71
4.4.30.0060.0124.76
4.4.20.0060.0164.84
4.4.10.0050.0134.85
4.4.00.0010.0274.76
4.3.110.0050.0144.66
4.3.100.0030.0154.66
4.3.90.0020.0184.63
4.3.80.0040.0234.58
4.3.70.0040.0134.63
4.3.60.0020.0154.63
4.3.50.0030.0154.63
4.3.40.0020.0244.54
4.3.30.0010.0173.30
4.3.20.0040.0143.28
4.3.10.0020.0153.24
4.3.00.0130.0237.59

preferences:
48.99 ms | 400 KiB | 5 Q