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 = 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.60.0130.00916.63
8.3.50.0110.00721.97
8.3.40.0060.00918.84
8.3.30.0060.00819.17
8.3.20.0040.00420.46
8.3.10.0030.00523.61
8.3.00.0050.00319.38
8.2.180.0140.00418.41
8.2.170.0090.01222.96
8.2.160.0100.00720.23
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0080.00822.34
8.2.110.0060.00322.17
8.2.100.0060.00617.74
8.2.90.0080.00019.12
8.2.80.0080.00018.05
8.2.70.0050.00317.63
8.2.60.0070.00418.05
8.2.50.0040.00418.07
8.2.40.0050.00318.28
8.2.30.0000.00818.22
8.2.20.0000.00817.83
8.2.10.0050.00318.13
8.2.00.0040.00417.78
8.1.280.0120.00425.92
8.1.270.0040.00422.07
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00924.07
8.1.230.0070.00419.11
8.1.220.0040.00417.79
8.1.210.0050.00318.77
8.1.200.0060.00317.35
8.1.190.0050.00317.64
8.1.180.0040.00418.10
8.1.170.0040.00418.59
8.1.160.0030.00622.04
8.1.150.0080.00018.75
8.1.140.0040.00417.45
8.1.130.0000.00817.93
8.1.120.0000.00717.52
8.1.110.0000.00817.41
8.1.100.0000.00717.55
8.1.90.0060.00317.58
8.1.80.0000.00917.55
8.1.70.0040.00417.49
8.1.60.0050.00517.65
8.1.50.0050.00317.66
8.1.40.0030.00517.67
8.1.30.0000.00817.72
8.1.20.0000.00717.73
8.1.10.0000.00817.61
8.1.00.0080.00017.62
8.0.300.0070.00018.77
8.0.290.0040.00417.18
8.0.280.0030.00318.46
8.0.270.0030.00317.32
8.0.260.0030.00316.98
8.0.250.0000.00717.06
8.0.240.0030.00517.05
8.0.230.0040.00416.93
8.0.220.0030.00316.97
8.0.210.0030.00316.82
8.0.200.0000.00717.09
8.0.190.0090.00017.01
8.0.180.0040.00417.01
8.0.170.0000.00817.03
8.0.160.0070.00016.97
8.0.150.0000.00717.01
8.0.140.0040.00416.89
8.0.130.0060.00013.45
8.0.120.0040.00416.97
8.0.110.0040.00416.90
8.0.100.0040.00416.91
8.0.90.0000.00716.79
8.0.80.0080.00616.99
8.0.70.0070.00016.95
8.0.60.0040.00417.05
8.0.50.0000.00716.93
8.0.30.0140.00817.05
8.0.20.0140.00517.40
8.0.10.0040.00417.18
8.0.00.0120.00616.64
7.4.330.0000.00715.00
7.4.320.0070.00016.67
7.4.300.0000.00716.57
7.4.290.0030.00316.49
7.4.280.0000.00716.44
7.4.270.0040.00416.71
7.4.260.0030.00616.57
7.4.250.0040.00416.47
7.4.240.0000.00716.63
7.4.230.0030.00516.76
7.4.220.0070.01116.57
7.4.210.0080.00916.66
7.4.200.0040.00416.59
7.4.190.0080.00016.76
7.4.160.0120.01216.55
7.4.150.0030.01417.40
7.4.140.0060.01417.86
7.4.130.0070.01016.53
7.4.120.0100.00716.64
7.4.110.0030.01516.65
7.4.100.0070.01116.59
7.4.90.0000.01716.71
7.4.80.0120.00619.39
7.4.70.0030.01616.68
7.4.60.0170.00016.61
7.4.50.0030.00616.44
7.4.40.0070.00722.77
7.4.30.0120.00316.50
7.4.00.0030.01415.14
7.3.330.0000.00513.33
7.3.320.0040.00413.24
7.3.310.0000.00616.47
7.3.300.0020.00516.28
7.3.290.0030.01016.53
7.3.280.0040.01216.47
7.3.270.0120.00317.40
7.3.260.0080.01616.39
7.3.250.0110.01016.52
7.3.240.0100.00716.45
7.3.230.0100.00716.48
7.3.210.0120.00616.58
7.3.200.0110.01119.39
7.3.190.0060.01516.46
7.3.180.0100.00616.66
7.3.170.0110.00516.55
7.3.160.0090.00616.40
7.3.120.0030.01214.85
7.3.10.0090.01016.43
7.3.00.0110.00716.22
7.2.330.0090.00916.70
7.2.320.0060.01216.65
7.2.310.0070.01416.64
7.2.300.0060.00916.84
7.2.290.0070.01016.73
7.2.130.0120.00916.93
7.2.120.0130.00316.63
7.2.110.0080.00916.68
7.2.100.0110.00816.56
7.2.90.0130.00716.56
7.2.80.0090.00516.65
7.2.70.0090.00516.41
7.2.60.0070.00716.78
7.2.50.0090.00516.61
7.2.40.0110.00716.54
7.2.30.0110.00816.64
7.2.20.0130.00416.57
7.2.10.0140.00416.60
7.2.00.0090.00616.84
7.1.250.0050.00815.67
7.1.200.0040.00715.56
7.1.70.0000.00817.18
7.1.60.0040.00717.38
7.1.50.0000.01416.77
7.1.40.0060.00616.61
7.1.30.0000.01116.71
7.1.20.0070.00416.96
7.1.10.0040.00416.55
7.1.00.0000.00716.71
7.0.200.0000.00816.92
7.0.190.0100.00016.73
7.0.180.0040.00416.31
7.0.170.0040.00416.48
7.0.160.0000.01016.45
7.0.150.0060.00316.29
7.0.140.0000.00816.60
7.0.130.0000.00716.34
7.0.120.0050.00316.62
7.0.110.0090.00316.46
7.0.100.0050.00316.23
7.0.90.0000.00716.38
7.0.80.0030.00516.38
7.0.70.0030.00616.62
7.0.60.0000.00816.17
7.0.50.0000.00816.21
7.0.40.0030.00715.08
7.0.30.0000.00815.08
7.0.20.0000.00915.08
7.0.10.0040.00415.08
7.0.00.0000.00715.08
5.6.300.0030.04220.68
5.6.290.0030.04120.89
5.6.280.0070.04021.00
5.6.270.0070.04320.87
5.6.260.0000.04720.84
5.6.250.0100.03720.78
5.6.240.0000.04820.96
5.6.230.0030.04220.83
5.6.220.0030.04320.94
5.6.210.0030.04520.63
5.6.200.0030.04420.82
5.6.190.0000.04620.74
5.6.180.0070.03720.83
5.6.170.0030.05420.97
5.6.160.0000.04320.76
5.6.150.0030.04221.02
5.6.140.0030.04120.74
5.6.130.0030.04120.80
5.6.120.0000.04520.79
5.6.110.0000.04820.76
5.6.100.0040.04920.92
5.6.90.0100.03620.83
5.6.80.0000.04520.24
5.6.70.0070.08320.19
5.6.60.0030.04020.18
5.6.50.0060.03820.25
5.6.40.0030.04120.19
5.6.30.0000.05420.27
5.6.20.0030.04420.18
5.6.10.0070.03420.18
5.6.00.0030.04620.16
5.5.380.0000.04517.63
5.5.370.0060.03517.53
5.5.360.0060.03717.39
5.5.350.0000.04917.48
5.5.340.0030.04317.87
5.5.330.0030.04417.75
5.5.320.0270.03018.09
5.5.310.0030.03718.11
5.5.300.0040.03918.02
5.5.290.0030.04017.83
5.5.280.0000.04218.09
5.5.270.0030.04417.99
5.5.260.0030.04418.07
5.5.250.0070.03617.81
5.5.240.0100.03317.42
5.5.230.0030.04217.55
5.5.220.0000.04117.55
5.5.210.0030.04017.08
5.5.200.0070.04717.36
5.5.190.0000.04617.36
5.5.180.0000.04417.43
5.5.160.0070.03317.44
5.5.150.0100.03617.21
5.5.140.0070.04317.43
5.5.130.0090.04117.46
5.5.120.0060.03917.46
5.5.110.0030.05317.43
5.5.100.0000.04417.32
5.5.90.0000.05217.22
5.5.80.0040.03917.43
5.5.70.0070.04117.27
5.5.60.0030.05416.98
5.5.50.0060.03617.43
5.5.40.0070.03317.33
5.5.30.0030.04217.29
5.5.20.0030.04017.33
5.5.10.0070.03717.37
5.5.00.0000.04317.23
5.4.450.0030.04219.40
5.4.440.0030.04219.56
5.4.430.0100.03419.21
5.4.420.0030.03919.39
5.4.410.0060.03519.32
5.4.400.0040.03518.98
5.4.390.0040.03918.96
5.4.380.0070.03719.01
5.4.370.0070.03319.06
5.4.360.0030.04319.20
5.4.350.0030.04018.94
5.4.340.0070.04119.05
5.4.320.0060.03919.05
5.4.310.0070.03318.89
5.4.300.0070.03418.92
5.4.290.0000.04519.20
5.4.280.0030.04118.98
5.4.270.0030.03519.22
5.4.260.0070.03419.12
5.4.250.0000.04319.09
5.4.240.0070.03619.06
5.4.230.0030.04119.05
5.4.220.0030.04518.97
5.4.210.0000.04018.89
5.4.200.0030.03918.96
5.4.190.0030.04519.22
5.4.180.0070.03518.95
5.4.170.0330.03619.21
5.4.160.0030.03718.93
5.4.150.0030.04119.18
5.4.140.0100.04616.58
5.4.130.0030.04516.67
5.4.120.0030.05416.46
5.4.110.0030.03516.74
5.4.100.0060.03816.71
5.4.90.0100.04316.63
5.4.80.0100.05516.73
5.4.70.0060.03116.63
5.4.60.0030.03516.60
5.4.50.0070.03916.37
5.4.40.0000.03716.67
5.4.30.0000.03916.69
5.4.20.0000.04016.71
5.4.10.0060.04516.72
5.4.00.0030.03415.89
5.3.290.0060.03615.08
5.3.280.0070.03415.08
5.3.270.0100.03515.08
5.3.260.0030.04315.08
5.3.250.0030.03815.08
5.3.240.0100.07315.08
5.3.230.0030.03915.08
5.3.220.0030.04315.08
5.3.210.0030.04115.08
5.3.200.0000.04515.08
5.3.190.0030.03515.08
5.3.180.0030.03915.08
5.3.170.0030.03815.08
5.3.160.0030.03515.08
5.3.150.0030.03415.08
5.3.140.0000.04415.08
5.3.130.0070.03715.08
5.3.120.0030.03515.08
5.3.110.0030.04515.08
5.3.100.0190.04515.08
5.3.90.0100.03615.08
5.3.80.0030.03615.08
5.3.70.0070.03015.08
5.3.60.0070.03315.08
5.3.50.0210.03415.08
5.3.40.0100.03115.08
5.3.30.0000.04015.08
5.3.20.0040.03515.08
5.3.10.0030.04415.08
5.3.00.0000.03815.08
5.2.170.0030.03015.08
5.2.160.0000.03615.08
5.2.150.0000.03315.08
5.2.140.0030.03115.08
5.2.130.0030.03015.08
5.2.120.0000.03215.08
5.2.110.0000.03115.08
5.2.100.0030.02815.08
5.2.90.0040.02815.08
5.2.80.0030.03515.08
5.2.70.0000.03715.08
5.2.60.0060.03215.08
5.2.50.0160.02615.08
5.2.40.0000.03215.08
5.2.30.0160.02615.08
5.2.20.0040.02915.08
5.2.10.0000.03315.08
5.2.00.0030.02815.08
5.1.60.0160.02315.08
5.1.50.0140.02515.08
5.1.40.0060.01915.08
5.1.30.0070.02315.08
5.1.20.0000.03515.08
5.1.10.0030.02515.08
5.1.00.0000.02615.08
5.0.50.0030.02115.08
5.0.40.0000.02315.08
5.0.30.0070.04415.08
5.0.20.0000.02415.08
5.0.10.0180.00915.08
5.0.00.0030.03315.08
4.4.90.0000.01815.08
4.4.80.0140.00715.08
4.4.70.0040.01515.08
4.4.60.0030.01415.08
4.4.50.0080.01115.08
4.4.40.0030.02515.08
4.4.30.0060.01115.08
4.4.20.0060.02215.08
4.4.10.0030.01515.08
4.4.00.0000.02715.08
4.3.110.0000.01615.08
4.3.100.0000.01715.08
4.3.90.0000.01815.08
4.3.80.0000.03015.08
4.3.70.0040.01515.08
4.3.60.0030.01315.08
4.3.50.0030.01715.08
4.3.40.0000.02915.08
4.3.30.0160.00615.08
4.3.20.0100.01615.08
4.3.10.0030.01515.08
4.3.00.0000.01715.08

preferences:
48.07 ms | 401 KiB | 5 Q