3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! $data = array( array('a', 'b', 'c', 'd', 'e'), array('f', 'g', 'h', 'i', 'j'), array('k', 'l', 'm', 'n', 'o'), array('p', 'q', 'r') ); echo "<pre>"; //print_r(array_chunk($data,4,true)); //die(); $width = count($data[0]); // 5 $height = count($data); // 4 $total = $width * $height; // 20 $new_data = array(); for($i = 0; $i < $total; $i++) { $old_x = floor($i % $width); // integer division $old_y = $i / $width; // modulo $new_x = $i % $height; // modulo $new_y = floor($i / $height); // integer division if (!isset($new_data[$new_x])) { $new_data[$new_x] = array(); } if (isset($data[$old_x][$old_y])) { $new_data[$new_x][$new_y] = $data[$old_x][$old_y]; } } print_r($new_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.3.40.0110.00419.07
8.3.30.0090.00618.98
8.3.20.0060.00318.94
8.3.10.0050.00319.31
8.3.00.0080.00023.78
8.2.170.0080.00822.96
8.2.160.0120.00320.95
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0080.00026.16
8.2.120.0040.00421.16
8.2.110.0090.00020.70
8.2.100.0060.00617.84
8.2.90.0040.00419.06
8.2.80.0050.00318.05
8.2.70.0050.00317.75
8.2.60.0080.00018.05
8.2.50.0050.00318.07
8.2.40.0040.00418.19
8.2.30.0030.00519.95
8.2.20.0000.00717.69
8.2.10.0070.00017.71
8.2.00.0000.01017.71
8.1.270.0050.00223.99
8.1.260.0090.00026.35
8.1.250.0000.00828.09
8.1.240.0030.00624.00
8.1.230.0110.00020.97
8.1.220.0050.00318.77
8.1.210.0040.00419.04
8.1.200.0030.00617.48
8.1.190.0000.00917.68
8.1.180.0000.00818.10
8.1.170.0000.00818.71
8.1.160.0040.00418.93
8.1.150.0030.00618.72
8.1.140.0000.00717.59
8.1.130.0030.00317.93
8.1.120.0030.00517.48
8.1.110.0040.00417.55
8.1.100.0000.00817.44
8.1.90.0000.00717.46
8.1.80.0040.00417.55
8.1.70.0050.00317.51
8.1.60.0000.00817.71
8.1.50.0070.00017.53
8.1.40.0040.00417.55
8.1.30.0000.00817.77
8.1.20.0040.00417.81
8.1.10.0000.00817.62
8.1.00.0080.00017.53
8.0.300.0000.00720.01
8.0.290.0040.00417.29
8.0.280.0040.00418.42
8.0.270.0040.00417.29
8.0.260.0030.00316.96
8.0.250.0050.00317.02
8.0.240.0080.00017.04
8.0.230.0000.00716.96
8.0.220.0030.00316.90
8.0.210.0030.00317.03
8.0.200.0030.00317.01
8.0.190.0070.00016.89
8.0.180.0040.00417.02
8.0.170.0040.00417.03
8.0.160.0030.00317.05
8.0.150.0050.00316.97
8.0.140.0060.00317.00
8.0.130.0030.00313.43
8.0.120.0000.00716.84
8.0.110.0000.00816.83
8.0.100.0040.00416.86
8.0.90.0000.00717.05
8.0.80.0070.01616.93
8.0.70.0050.00216.84
8.0.60.0000.00816.97
8.0.50.0040.00417.05
8.0.30.0090.01017.40
8.0.20.0120.00717.46
8.0.10.0090.00017.02
8.0.00.0090.00916.94
7.4.330.0020.00214.75
7.4.320.0000.00716.51
7.4.300.0030.00316.74
7.4.290.0050.00216.61
7.4.280.0040.00416.61
7.4.270.0030.00316.70
7.4.260.0060.00013.40
7.4.250.0070.00016.59
7.4.240.0000.00716.53
7.4.230.0000.00716.70
7.4.220.0060.01516.57
7.4.210.0070.00916.68
7.4.200.0040.00416.67
7.4.190.0050.00216.55
7.4.160.0080.00816.63
7.4.150.0140.00917.40
7.4.140.0090.00917.86
7.4.130.0140.00516.71
7.4.120.0110.00516.38
7.4.110.0100.00716.75
7.4.100.0140.00316.67
7.4.90.0090.00816.57
7.4.80.0070.01319.37
7.4.70.0180.00016.41
7.4.60.0070.01016.56
7.4.50.0040.00716.70
7.4.40.0100.00722.52
7.4.30.0100.00716.79
7.4.10.0040.01514.69
7.4.00.0090.01114.95
7.3.330.0030.00313.09
7.3.320.0030.00313.28
7.3.310.0040.00416.35
7.3.300.0000.00716.46
7.3.290.0110.00316.33
7.3.280.0080.00816.45
7.3.270.0150.01117.40
7.3.260.0110.00618.24
7.3.250.0080.00816.46
7.3.240.0100.01316.71
7.3.230.0160.00016.39
7.3.210.0040.01516.77
7.3.200.0030.01519.39
7.3.190.0120.01016.56
7.3.180.0030.01316.44
7.3.170.0060.00916.35
7.3.160.0080.00816.47
7.3.130.0100.00714.72
7.3.120.0080.01114.68
7.3.110.0030.01514.72
7.3.100.0030.01015.11
7.3.90.0030.00715.14
7.3.80.0080.00314.61
7.3.70.0070.00715.06
7.3.60.0000.01514.85
7.3.50.0040.00814.79
7.3.40.0030.01014.81
7.3.30.0030.01014.87
7.3.20.0060.00616.72
7.3.10.0050.00916.74
7.3.00.0070.00416.72
7.2.330.0070.01016.49
7.2.320.0090.00916.69
7.2.310.0070.01116.56
7.2.300.0160.00016.58
7.2.290.0130.00316.50
7.2.260.0060.00914.95
7.2.250.0100.00614.93
7.2.240.0090.00615.37
7.2.230.0060.00614.74
7.2.220.0000.01015.04
7.2.210.0000.01015.04
7.2.200.0060.00915.27
7.2.190.0070.00715.14
7.2.180.0040.00815.15
7.2.170.0070.00714.94
7.2.160.0080.00314.73
7.2.150.0040.01116.67
7.2.140.0100.00417.03
7.2.130.0080.00816.99
7.2.120.0090.00616.93
7.2.110.0020.01016.85
7.2.100.0060.00416.92
7.2.90.0050.00916.86
7.2.80.0020.01517.04
7.2.70.0070.00516.85
7.2.60.0050.01116.96
7.2.50.0040.01216.93
7.2.40.0040.01117.12
7.2.30.0050.00816.86
7.2.20.0020.01216.89
7.2.10.0060.00716.88
7.2.00.0080.00317.02
7.1.330.0060.00915.71
7.1.320.0120.00015.84
7.1.310.0040.00715.91
7.1.300.0080.00615.73
7.1.290.0000.01115.78
7.1.280.0030.00915.95
7.1.270.0040.00815.89
7.1.260.0060.00615.89
7.1.250.0060.01115.73
7.1.240.0070.00715.82
7.1.230.0000.01015.91
7.1.220.0090.00615.88
7.1.210.0000.01515.87
7.1.200.0030.01015.79
7.1.190.0030.00915.78
7.1.180.0000.01615.92
7.1.170.0030.01015.88
7.1.160.0040.00715.90
7.1.150.0060.00615.79
7.1.140.0060.00315.78
7.1.130.0030.00715.78
7.1.120.0080.00415.62
7.1.110.0090.00315.86
7.1.100.0060.01015.99
7.1.90.0090.00015.99
7.1.80.0030.01415.99
7.1.70.0080.00716.50
7.1.60.0070.01317.66
7.1.50.0070.00616.32
7.1.40.0110.00615.80
7.1.30.0030.01015.79
7.1.20.0060.00315.52
7.1.10.0040.01015.85
7.1.00.0020.02219.25
7.0.330.0000.00915.50
7.0.320.0100.00615.20
7.0.310.0030.00915.39
7.0.300.0070.01015.26
7.0.290.0060.00915.21
7.0.280.0070.00715.27
7.0.270.0070.00715.27
7.0.260.0030.01015.41
7.0.250.0000.00915.48
7.0.240.0040.01115.43
7.0.230.0120.00315.51
7.0.220.0040.01415.41
7.0.210.0100.00615.31
7.0.200.0410.00515.18
7.0.190.0000.01115.23
7.0.180.0040.01115.54
7.0.170.0060.00315.55
7.0.160.0120.00315.48
7.0.150.0040.00415.44
7.0.140.0070.03718.73
7.0.130.0000.01215.52
7.0.120.0060.00615.21
7.0.110.0090.00315.54
7.0.100.0120.00015.34
7.0.90.0040.01115.20
7.0.80.0120.00315.63
7.0.70.0080.04118.57
7.0.60.0070.04618.61
7.0.50.0050.04018.72
7.0.40.0050.04516.69
7.0.30.0070.04716.71
7.0.20.0100.03516.83
7.0.10.0030.03716.82
7.0.00.0050.04116.87
5.6.400.0060.00314.65
5.6.390.0060.00914.70
5.6.380.0030.01314.36
5.6.370.0030.01414.54
5.6.360.0080.00614.25
5.6.350.0120.00414.49
5.6.340.0080.00814.47
5.6.330.0060.01014.31
5.6.320.0040.01114.43
5.6.310.0040.01114.25
5.6.300.0120.00314.43
5.6.290.0030.01214.70
5.6.280.0010.04417.57
5.6.270.0060.00314.73
5.6.260.0060.00914.30
5.6.250.0070.00714.38
5.6.240.0030.01214.58
5.6.230.0030.00914.54
5.6.220.0070.03517.53
5.6.210.0050.04617.59
5.6.200.0030.04017.79
5.6.190.0010.03617.79
5.6.180.0020.04717.77
5.6.170.0050.04917.66
5.6.160.0020.05017.74
5.6.150.0080.04517.68
5.6.140.0060.03317.81
5.6.130.0070.03217.88
5.6.120.0110.03017.70
5.6.110.0050.04317.72
5.6.100.0050.04317.84
5.6.90.0070.03317.72
5.6.80.0080.04117.31
5.6.70.0080.04217.53
5.6.60.0070.02417.43
5.6.50.0050.04317.31
5.6.40.0060.04517.43
5.6.30.0020.04317.40
5.6.20.0050.04017.43
5.6.10.0020.04217.30
5.6.00.0060.04317.47
5.5.380.0030.01514.44
5.5.370.0070.00714.70
5.5.360.0040.04217.24
5.5.350.0070.04517.40
5.5.340.0070.03717.79
5.5.330.0080.02817.56
5.5.320.0080.04317.77
5.5.310.0020.04717.59
5.5.300.0040.04817.64
5.5.290.0070.02817.72
5.5.280.0060.04517.67
5.5.270.0040.03217.75
5.5.260.0080.03917.64
5.5.250.0060.03117.44
5.5.240.0080.02617.32
5.5.230.0040.03717.35
5.5.220.0020.02617.50
5.5.210.0050.03017.12
5.5.200.0030.04517.35
5.5.190.0080.04317.24
5.5.180.0030.02617.16
5.5.170.0070.00314.29
5.5.160.0030.04517.31
5.5.150.0040.03917.30
5.5.140.0080.03817.21
5.5.130.0100.03517.31
5.5.120.0050.04117.23
5.5.110.0050.04717.39
5.5.100.0050.04317.21
5.5.90.0070.04117.19
5.5.80.0050.03017.25
5.5.70.0050.03817.27
5.5.60.0030.04217.31
5.5.50.0070.04217.29
5.5.40.0050.04117.19
5.5.30.0050.03817.24
5.5.20.0060.04317.32
5.5.10.0060.04117.08
5.5.00.0140.02317.12
5.4.450.0080.03315.77
5.4.440.0050.03615.79
5.4.430.0070.03715.77
5.4.420.0030.02515.78
5.4.410.0020.03515.66
5.4.400.0060.03515.61
5.4.390.0090.02415.57
5.4.380.0040.03515.57
5.4.370.0040.02715.49
5.4.360.0050.03715.63
5.4.350.0030.03015.52
5.4.340.0020.03215.57
5.4.330.0040.00412.09
5.4.320.0090.03715.61
5.4.310.0020.04215.56
5.4.300.0070.03815.55
5.4.290.0100.03515.63
5.4.280.0080.03315.56
5.4.270.0040.04115.59
5.4.260.0060.02715.56
5.4.250.0000.04215.51
5.4.240.0030.03315.55
5.4.230.0070.03715.64
5.4.220.0030.03315.60
5.4.210.0050.03515.61
5.4.200.0040.03515.62
5.4.190.0040.03215.46
5.4.180.0070.03415.58
5.4.170.0040.04115.62
5.4.160.0060.04015.48
5.4.150.0040.03215.46
5.4.140.0030.03314.22
5.4.130.0050.03514.22
5.4.120.0050.02814.22
5.4.110.0070.02714.17
5.4.100.0030.04214.28
5.4.90.0050.03814.25
5.4.80.0020.03014.30
5.4.70.0020.03414.29
5.4.60.0020.03014.25
5.4.50.0060.04114.24
5.4.40.0080.02014.31
5.4.30.0030.03314.28
5.4.20.0090.03014.21
5.4.10.0060.03714.21
5.4.00.0020.04113.83
5.3.290.0040.03913.38
5.3.280.0020.04213.31
5.3.270.0000.03013.34
5.3.260.0030.03213.33
5.3.250.0020.03913.39
5.3.240.0020.02813.42
5.3.230.0010.03413.40
5.3.220.0040.04013.34
5.3.210.0030.03313.37
5.3.200.0090.03513.33
5.3.190.0020.04113.39
5.3.180.0020.02913.38
5.3.170.0000.03813.40
5.3.160.0000.03413.34
5.3.150.0030.03313.33
5.3.140.0030.02513.37
5.3.130.0080.02013.38
5.3.120.0020.04313.39
5.3.110.0010.03113.33
5.3.100.0030.03813.12
5.3.90.0020.03313.07
5.3.80.0050.03813.10
5.3.70.0000.03013.02
5.3.60.0000.03313.11
5.3.50.0040.03513.03
5.3.40.0030.03213.03
5.3.30.0030.04313.00
5.3.20.0020.03312.86
5.3.10.0020.03912.84
5.3.00.0080.01912.83
5.2.170.0000.05011.15
5.2.160.0030.05311.05
5.2.150.0000.04711.07
5.2.140.0000.06711.26
5.2.130.0030.06011.21
5.2.120.0070.05711.17
5.2.110.0030.05011.20
5.2.100.0070.05011.09
5.2.90.0030.05311.24
5.2.80.0100.05711.15
5.2.70.0000.05711.19
5.2.60.0000.06011.11
5.2.50.0030.06011.04
5.2.40.0000.05311.07
5.2.30.0030.04711.12
5.2.20.0100.04710.97
5.2.10.0030.03310.98
5.2.00.0000.04010.62
5.1.60.0000.03310.23
5.1.50.0030.02310.23
5.1.40.0070.02710.23
5.1.30.0030.06010.36
5.1.20.0030.05310.42
5.1.10.0000.04310.23
5.1.00.0000.04010.23
5.0.50.0030.02710.23
5.0.40.0000.02710.23
5.0.30.0000.03310.23
5.0.20.0000.02010.23
5.0.10.0000.02010.23
5.0.00.0000.03010.23
4.4.90.0000.03710.23
4.4.80.0000.02710.23
4.4.70.0030.03710.23
4.4.60.0100.02710.23
4.4.50.0030.02310.23
4.4.40.0000.03710.23
4.4.30.0030.01710.23
4.4.20.0000.03310.23
4.4.10.0070.01710.23
4.4.00.0030.02310.23
4.3.110.0000.01710.23
4.3.100.0000.01310.23
4.3.90.0000.01310.23
4.3.80.0000.02310.23
4.3.70.0000.02010.23
4.3.60.0000.01310.23
4.3.50.0000.02010.23
4.3.40.0030.02310.23
4.3.30.0030.02710.23
4.3.20.0000.01710.23
4.3.10.0000.01710.23
4.3.00.0000.01710.23

preferences:
75.52 ms | 400 KiB | 5 Q