3v4l.org

run code in 300+ PHP versions simultaneously
<?php function restructure($x,$slots) { $result=array(); $count=count($x); $least=(int)($count/$slots); $excess=$count-$least*$slots; for($i=0;$i<($least+1)*$excess;$i+=$least+1) array_push($result,implode(", ",array_slice($x,$i,$least+1))); for(;$i<$count;$i+=$least) array_push($result,implode(", ",array_slice($x,$i,$least))); return $result; } $x=array( "item 1", "item 2", "item 3", "item 4", "item 5", "item 6", "item 7", ); print_r(restructure($x,5));

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.120.0110.00920.52
8.4.110.0140.00520.88
8.4.100.0120.00917.69
8.4.90.0140.00720.59
8.4.80.0130.00618.92
8.4.70.0110.00822.40
8.4.60.0100.01018.90
8.4.50.0020.00620.14
8.4.40.0110.00717.55
8.4.30.0120.00318.61
8.4.20.0130.00319.47
8.4.10.0100.01019.34
8.3.250.0080.00818.61
8.3.240.0100.01018.86
8.3.230.0050.00416.68
8.3.220.0090.01018.71
8.3.210.0060.00816.70
8.3.200.0050.00416.85
8.3.190.0120.00717.16
8.3.180.0100.00916.86
8.3.170.0040.01416.85
8.3.160.0110.00716.71
8.3.150.0110.00720.70
8.3.140.0130.00617.16
8.3.130.0080.00018.66
8.3.120.0090.00018.71
8.3.110.0030.00620.94
8.3.100.0030.00616.80
8.3.90.0060.01318.67
8.3.80.0030.00718.55
8.3.70.0120.00618.40
8.3.60.0140.00716.63
8.3.50.0090.00824.38
8.3.40.0070.00718.84
8.3.30.0070.00718.45
8.3.20.0080.00024.18
8.3.10.0050.00224.66
8.3.00.0080.00026.16
8.2.290.0110.00816.72
8.2.280.0050.00518.47
8.2.270.0090.00916.98
8.2.260.0110.00716.43
8.2.250.0090.00016.72
8.2.240.0070.01118.96
8.2.230.0080.00622.58
8.2.220.0000.00824.06
8.2.210.0050.00326.77
8.2.200.0060.00316.13
8.2.190.0060.01516.58
8.2.180.0070.00725.92
8.2.170.0140.00418.68
8.2.160.0130.00322.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0040.00426.35
8.2.110.0000.00920.52
8.2.100.0060.00617.84
8.2.90.0040.00717.88
8.2.80.0030.00618.77
8.2.70.0030.00517.75
8.2.60.0030.00517.63
8.2.50.0000.00818.05
8.2.40.0090.00018.16
8.2.30.0040.00418.10
8.2.20.0040.00418.16
8.2.10.0040.00419.36
8.2.00.0070.00019.23
8.1.330.0120.00716.09
8.1.320.0080.01118.11
8.1.310.0100.00720.06
8.1.300.0120.00618.59
8.1.290.0040.00718.88
8.1.280.0170.00025.92
8.1.270.0030.00623.95
8.1.260.0060.00328.09
8.1.250.0030.00528.09
8.1.240.0060.00323.91
8.1.230.0110.00020.88
8.1.220.0000.00817.79
8.1.210.0000.00818.77
8.1.200.0040.00417.36
8.1.190.0000.00817.23
8.1.180.0000.00818.10
8.1.170.0040.00418.40
8.1.160.0040.00418.80
8.1.150.0040.00418.76
8.1.140.0070.00018.81
8.1.130.0070.00017.44
8.1.120.0030.00617.47
8.1.110.0040.00417.51
8.1.100.0000.01017.49
8.1.90.0000.00717.43
8.1.80.0140.00017.42
8.1.70.0000.00717.46
8.1.60.0000.00917.63
8.1.50.0040.00417.50
8.1.40.0000.00817.52
8.1.30.0000.00817.68
8.1.20.0000.00817.62
8.1.10.0040.00417.36
8.1.00.0000.01017.30
8.0.300.0040.00418.81
8.0.290.0050.00516.75
8.0.280.0030.00320.15
8.0.270.0030.00318.01
8.0.260.0030.00316.84
8.0.250.0040.00416.88
8.0.240.0000.00716.84
8.0.230.0000.00716.91
8.0.220.0000.00616.77
8.0.210.0070.00016.80
8.0.200.0050.00216.84
8.0.190.0040.00416.95
8.0.180.0040.00416.88
8.0.170.0040.00416.97
8.0.160.0050.00216.91
8.0.150.0040.00416.80
8.0.140.0000.00816.84
8.0.130.0000.00513.32
8.0.120.0020.00516.89
8.0.110.0030.00316.95
8.0.100.0000.00716.71
8.0.90.0040.00416.83
8.0.80.0090.00816.85
8.0.70.0040.00416.74
8.0.60.0030.00516.74
8.0.50.0000.00816.77
8.0.30.0110.00617.30
8.0.20.0080.01516.97
8.0.10.0040.00416.88
8.0.00.0130.00716.63
7.4.330.0050.00015.55
7.4.320.0070.00016.63
7.4.300.0060.00016.45
7.4.290.0070.00016.59
7.4.280.0030.00716.60
7.4.270.0040.00416.64
7.4.260.0030.00313.28
7.4.250.0000.00716.36
7.4.240.0020.00516.51
7.4.230.0050.00316.41
7.4.220.0060.00016.42
7.4.210.0050.01116.56
7.4.200.0040.00416.63
7.4.130.0120.00516.62
7.4.120.0160.00016.35
7.4.110.0060.01016.36
7.4.100.0060.01016.51
7.4.90.0170.00616.60
7.4.80.0140.01016.58
7.4.70.0130.00616.35
7.4.60.0150.00516.52
7.4.50.0080.01116.66
7.4.40.0210.02316.50
7.4.30.0100.01016.52
7.4.20.0150.01116.63
7.4.10.0160.01216.52
7.4.00.0090.01116.33
7.3.330.0060.00316.38
7.3.320.0000.00613.22
7.3.310.0070.00016.38
7.3.300.0000.00716.22
7.3.290.0070.00916.35
7.3.280.0070.01316.38
7.3.260.0080.01116.37
7.3.230.0100.00716.25
7.3.210.0130.00416.41
7.3.200.0130.00816.41
7.3.190.0130.00816.60
7.3.180.0130.00616.28
7.3.170.0090.00916.44
7.3.160.0100.00816.37
7.3.150.0110.00716.41
7.3.140.0220.00416.57
7.3.130.0160.01016.61
7.3.120.0100.01016.45
7.3.110.0170.01016.58
7.3.100.0160.00816.49
7.3.90.0130.01016.45
7.3.80.0100.01116.37
7.3.70.0160.01016.31
7.3.60.0140.01116.39
7.3.50.0180.00616.55
7.3.40.0170.00616.31
7.3.30.0130.01116.31
7.3.20.0180.00516.19
7.3.10.0160.00916.26
7.3.00.0210.01216.47
7.2.330.0130.00416.78
7.2.320.0110.01216.80
7.2.310.0100.01016.69
7.2.300.0100.01216.58
7.2.290.0120.01016.59
7.2.280.0170.00916.59
7.2.270.0130.01416.41
7.2.260.0170.00616.72
7.2.250.0220.00516.71
7.2.240.0110.01316.75
7.2.230.0150.00816.64
7.2.220.0180.00616.51
7.2.210.0160.00816.73
7.2.200.0150.01316.52
7.2.190.0100.01516.61
7.2.180.0160.00716.58
7.2.170.0170.01216.52
7.2.160.0120.01416.59
7.2.150.0090.01516.50
7.2.140.0130.01016.45
7.2.130.0200.01116.56
7.2.120.0130.01416.70
7.2.110.0150.00716.71
7.2.100.0170.00716.76
7.2.90.0110.01416.77
7.2.80.0130.01116.74
7.2.70.0100.01716.56
7.2.60.0090.01616.58
7.2.50.0180.00816.54
7.2.40.0160.01416.50
7.2.30.0200.00816.75
7.2.20.0180.00916.71
7.2.10.0220.00616.72
7.2.00.0130.01216.55

preferences:
132.96 ms | 403 KiB | 5 Q