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') ); $width = count($data[0]); // 5 $height = count($data); // 4 $total = $width * $height; // 20 $new_data = array(); for($i = 0; $i < $total; $i++) { $old_x = ciel($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.60.0170.00316.63
8.3.50.0100.01021.89
8.3.40.0040.01118.71
8.3.30.0100.00319.09
8.3.20.0000.00820.34
8.3.10.0040.00423.48
8.3.00.0060.00319.38
8.2.180.0150.00318.54
8.2.170.0150.00022.96
8.2.160.0100.00320.47
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0100.00726.16
8.2.120.0040.00422.27
8.2.110.0060.00320.94
8.2.100.0080.00317.91
8.2.90.0000.00819.21
8.2.80.0040.00417.97
8.2.70.0000.00817.75
8.2.60.0040.00418.02
8.2.50.0000.00818.10
8.2.40.0030.00518.34
8.2.30.0030.00618.16
8.2.20.0000.00817.72
8.2.10.0030.00618.15
8.2.00.0060.00317.87
8.1.280.0140.00725.92
8.1.270.0040.00423.97
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0030.00622.62
8.1.230.0080.00417.83
8.1.220.0090.00017.79
8.1.210.0070.00418.77
8.1.200.0040.00417.35
8.1.190.0000.00917.22
8.1.180.0090.00018.10
8.1.170.0090.00320.43
8.1.160.0050.00321.96
8.1.150.0040.00418.61
8.1.140.0030.00517.48
8.1.130.0070.00017.93
8.1.120.0000.00717.41
8.1.110.0040.00417.46
8.1.100.0030.00317.48
8.1.90.0070.00017.38
8.1.80.0030.00317.38
8.1.70.0070.00017.43
8.1.60.0050.00317.61
8.1.50.0040.00417.44
8.1.40.0040.00417.43
8.1.30.0080.00017.61
8.1.20.0040.00417.69
8.1.10.0030.00617.56
8.1.00.0000.00717.40
8.0.300.0040.00418.77
8.0.290.0020.00516.88
8.0.280.0030.00318.47
8.0.270.0000.00717.21
8.0.260.0000.00616.80
8.0.250.0000.00717.12
8.0.240.0030.00517.05
8.0.230.0020.00516.98
8.0.220.0030.00316.97
8.0.210.0030.00516.92
8.0.200.0070.00016.87
8.0.190.0000.00717.07
8.0.180.0000.00716.98
8.0.170.0000.00717.05
8.0.160.0040.00416.96
8.0.150.0000.00716.92
8.0.140.0050.00316.86
8.0.130.0030.00313.29
8.0.120.0080.00016.95
8.0.110.0060.00316.90
8.0.100.0000.00716.93
8.0.90.0000.00716.94
8.0.80.0100.00517.03
8.0.70.0000.00716.89
8.0.60.0020.00516.95
8.0.50.0040.00417.05
8.0.30.0080.01317.22
8.0.20.0070.01017.40
8.0.10.0050.00216.97
8.0.00.0080.01316.86
7.4.330.0000.00515.06
7.4.320.0000.00616.54
7.4.300.0060.00016.62
7.4.290.0030.00316.67
7.4.280.0000.00716.63
7.4.270.0000.00716.49
7.4.260.0070.00016.52
7.4.250.0000.00716.59
7.4.240.0050.00216.59
7.4.230.0070.00016.74
7.4.220.0090.00916.43
7.4.210.0060.00716.57
7.4.200.0000.00716.43
7.4.190.0000.00816.63
7.4.160.0060.01016.56
7.4.150.0000.01717.40
7.4.140.0120.00717.86
7.4.130.0080.00816.48
7.4.120.0070.01516.57
7.4.110.0090.00916.63
7.4.100.0100.01316.59
7.4.90.0140.00316.52
7.4.80.0140.00519.39
7.4.70.0030.01316.54
7.4.60.0060.01016.50
7.4.50.0000.00816.46
7.4.40.0020.00722.77
7.4.30.0080.00816.65
7.4.00.0100.00715.09
7.3.330.0000.00513.15
7.3.320.0030.00313.26
7.3.310.0030.00316.27
7.3.300.0070.00016.41
7.3.290.0040.01116.39
7.3.280.0070.00916.35
7.3.270.0030.01417.40
7.3.260.0130.00716.32
7.3.250.0150.00416.47
7.3.240.0060.01716.38
7.3.230.0050.01116.45
7.3.210.0060.01216.44
7.3.200.0090.00919.39
7.3.190.0090.00916.55
7.3.180.0030.01316.50
7.3.170.0070.01116.40
7.3.160.0030.01316.39
7.3.120.0140.00214.97
7.3.110.0060.01015.07
7.3.100.0040.01114.69
7.3.90.0040.00714.76
7.3.80.0040.00814.91
7.3.70.0060.00314.50
7.3.60.0070.00314.88
7.3.50.0060.00614.80
7.3.40.0040.00714.76
7.3.30.0000.01514.84
7.3.20.0110.00716.38
7.3.10.0120.00616.83
7.3.00.0070.00716.86
7.2.330.0110.01116.49
7.2.320.0090.00916.71
7.2.310.0060.01016.73
7.2.300.0070.01016.52
7.2.290.0000.01616.70
7.2.250.0120.00614.98
7.2.240.0060.01014.98
7.2.230.0040.01115.25
7.2.220.0070.00714.95
7.2.210.0080.00414.90
7.2.200.0060.00314.79
7.2.190.0090.00015.00
7.2.180.0000.01114.76
7.2.170.0030.00715.04
7.2.60.0080.00816.56
7.2.00.0070.00719.53
7.1.330.0030.01016.03
7.1.320.0040.01115.83
7.1.310.0030.00715.96
7.1.300.0000.01415.76
7.1.290.0070.00715.84
7.1.280.0040.00715.59
7.1.270.0040.01115.94
7.1.260.0090.00915.49
7.1.200.0030.00315.71
7.1.100.0360.00517.89
7.1.70.0080.00317.09
7.1.60.0090.01519.33
7.1.50.0030.01717.01
7.1.00.0000.08022.43
7.0.200.0000.00716.75
7.0.140.0100.06722.12
7.0.60.0100.03320.06
7.0.50.0000.04317.89
7.0.40.0070.07720.21
7.0.30.0270.07720.20
7.0.20.0300.06320.00
7.0.10.0230.08020.09
7.0.00.0030.05020.00
5.6.280.0030.07320.92
5.6.210.0130.07720.48
5.6.200.0070.05718.09
5.6.190.0030.04720.41
5.6.180.3200.04020.44
5.6.170.0230.05020.45
5.6.160.0030.04320.49
5.6.150.0070.06718.13
5.6.140.0070.08018.07
5.6.130.0070.06318.07
5.6.120.0130.07720.99
5.6.110.0070.04321.09
5.6.100.0070.08020.99
5.6.90.0000.04321.00
5.6.80.0130.07020.49
5.6.70.0230.04320.48
5.5.350.0370.06720.37
5.5.340.0030.06317.95
5.5.330.0070.07320.28
5.5.320.0270.04320.32
5.5.310.0100.05020.19
5.5.300.0030.08017.98
5.5.290.0130.07717.91
5.5.280.0030.04320.91
5.5.270.0030.04320.88
5.5.260.0070.08720.89
5.5.250.0070.08020.59
5.5.240.0230.04020.05
5.4.450.0430.06019.48
5.4.440.0300.07019.40
5.4.430.0230.08319.40
5.4.420.0270.04719.11
5.4.410.0370.04019.45
5.4.400.0370.07019.22
5.4.390.0400.07719.25
5.4.380.0330.07018.81
5.4.370.0330.05719.14
5.4.360.0430.05718.79
5.4.350.0330.04318.93
5.4.340.0270.03719.09
5.4.320.0230.03719.09
5.4.310.0230.07318.93
5.4.300.0130.04319.08
5.4.290.0270.03018.80
5.4.280.0200.04318.92
5.4.270.0270.07319.24
5.4.260.0200.05019.20
5.4.250.0170.04019.26
5.4.240.0370.06019.12
5.4.230.0300.03319.05
5.4.220.0200.05019.15
5.4.210.0330.03319.09
5.4.200.0370.04019.12
5.4.190.0300.04718.80
5.4.180.0470.05719.23
5.4.170.0300.07019.04
5.4.160.0300.06019.21
5.4.150.0370.06319.14
5.4.140.0270.03016.29
5.4.130.0370.03316.22
5.4.120.0300.07016.26
5.4.110.0230.05016.38
5.4.100.0230.07016.20
5.4.90.0200.04016.48
5.4.80.0200.03316.19
5.4.70.0200.03716.48
5.4.60.0270.03316.32
5.4.50.0230.03316.38
5.4.40.0230.03016.30
5.4.30.0200.04016.38
5.4.20.0230.03016.19
5.4.10.0200.04716.47
5.4.00.0230.03715.88
5.3.290.0330.07014.51
5.3.280.0300.03314.63
5.3.270.0270.04014.64
5.3.260.0270.05014.57
5.3.250.0370.06314.55
5.3.240.0230.07314.64
5.3.230.0230.04314.55
5.3.220.0330.05714.48
5.3.210.0270.04314.52
5.3.200.0170.03714.62
5.3.190.0230.03314.45
5.3.180.0200.03714.41
5.3.170.0270.03014.41
5.3.160.0270.03714.55
5.3.150.0200.03314.43
5.3.140.0130.04014.40
5.3.130.0200.03714.65
5.3.120.0200.04014.54
5.3.110.0200.04014.42
5.3.100.0170.03714.00
5.3.90.0270.04013.87
5.3.80.0200.04013.91
5.3.70.0230.04314.06
5.3.60.0230.04013.94
5.3.50.0230.04013.91
5.3.40.0170.03714.05
5.3.30.0170.03713.77
5.3.20.0130.04013.56
5.3.10.0230.03013.71
5.3.00.0230.03013.58
5.2.170.0270.04311.91
5.2.160.0230.03011.91
5.2.150.0230.02711.91
5.2.140.0130.03711.91
5.2.130.0170.02711.91
5.2.120.0200.02311.91
5.2.110.0130.03011.91
5.2.100.0200.03011.91
5.2.90.0130.03011.91
5.2.80.0130.03011.91
5.2.70.0130.03011.91
5.2.60.0170.03311.91
5.2.50.0170.03311.91
5.2.40.0130.02711.91
5.2.30.0100.03011.91
5.2.20.0070.03311.91
5.2.10.0100.03011.91
5.2.00.0170.03311.91
5.1.60.0100.02711.91
5.1.50.0200.02011.91
5.1.40.0170.02011.91
5.1.30.0130.02711.91
5.1.20.0170.02011.91
5.1.10.0100.02711.91
5.1.00.0130.02311.91
5.0.50.0130.01311.91
5.0.40.0100.02011.91
5.0.30.0130.03011.91
5.0.20.0170.03711.91
5.0.10.0030.02311.91
5.0.00.0200.05711.91
4.4.90.0070.01311.91
4.4.80.0070.01311.91
4.4.70.0070.01711.91
4.4.60.0030.01711.91
4.4.50.0070.01711.91
4.4.40.0130.02011.91
4.4.30.0070.01711.91
4.4.20.0030.01711.91
4.4.10.0070.01311.91
4.4.00.0100.02711.91
4.3.110.0030.02311.91
4.3.100.0030.01711.91
4.3.90.0070.01711.91
4.3.80.0100.05311.91
4.3.70.0070.01711.91
4.3.60.0100.01711.91
4.3.50.0130.02311.91
4.3.40.0070.02711.91
4.3.30.0030.03311.91
4.3.20.0030.03011.91
4.3.10.0100.01311.91
4.3.00.0000.01711.91

preferences:
39.37 ms | 401 KiB | 5 Q