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.0180.00318.38
8.3.50.0130.00621.86
8.3.40.0120.00318.92
8.3.30.0070.00718.79
8.3.20.0090.00018.93
8.3.10.0040.00421.11
8.3.00.0050.00221.99
8.2.180.0090.00916.50
8.2.170.0070.00722.96
8.2.160.0070.00720.38
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0060.00326.16
8.2.120.0040.00419.63
8.2.110.0050.00520.65
8.2.100.0070.00418.16
8.2.90.0030.00619.36
8.2.80.0000.00818.16
8.2.70.0030.00817.50
8.2.60.0040.00418.05
8.2.50.0030.00518.07
8.2.40.0040.00418.28
8.2.30.0000.00921.40
8.2.20.0000.00717.72
8.2.10.0050.00317.84
8.2.00.0060.00317.89
8.1.280.0090.00625.92
8.1.270.0000.00723.99
8.1.260.0060.00326.35
8.1.250.0030.00928.09
8.1.240.0070.00322.55
8.1.230.0030.00920.92
8.1.220.0000.00818.77
8.1.210.0030.00618.97
8.1.200.0030.00617.47
8.1.190.0030.00617.63
8.1.180.0040.00418.10
8.1.170.0000.00818.64
8.1.160.0080.00018.97
8.1.150.0000.00818.61
8.1.140.0050.00317.46
8.1.130.0000.00717.80
8.1.120.0000.00717.59
8.1.110.0030.00717.51
8.1.100.0030.00417.51
8.1.90.0000.00717.59
8.1.80.0040.00417.58
8.1.70.0000.00817.48
8.1.60.0050.00517.73
8.1.50.0080.00017.62
8.1.40.0030.00617.52
8.1.30.0080.00017.78
8.1.20.0000.00817.63
8.1.10.0000.00817.70
8.1.00.0000.00817.67
8.0.300.0000.00720.10
8.0.290.0000.00717.17
8.0.280.0030.00318.55
8.0.270.0030.00317.36
8.0.260.0000.00616.91
8.0.250.0060.00316.98
8.0.240.0030.00517.04
8.0.230.0000.00816.93
8.0.220.0060.00316.90
8.0.210.0000.00716.98
8.0.200.0060.00317.06
8.0.190.0030.00417.04
8.0.180.0040.00416.97
8.0.170.0070.00017.05
8.0.160.0040.00417.03
8.0.150.0030.00416.85
8.0.140.0000.00716.99
8.0.130.0030.00313.41
8.0.120.0040.00416.98
8.0.110.0040.00416.97
8.0.100.0000.00716.86
8.0.90.0070.00017.01
8.0.80.0090.00917.05
8.0.70.0040.00417.01
8.0.60.0050.00316.93
8.0.50.0040.00416.82
8.0.30.0080.01017.32
8.0.20.0150.00417.40
8.0.10.0000.00717.14
8.0.00.0100.00916.96
7.4.330.0050.00014.89
7.4.320.0030.00316.68
7.4.300.0030.00316.52
7.4.290.0030.00316.72
7.4.280.0000.00716.57
7.4.270.0040.00416.54
7.4.260.0050.00013.26
7.4.250.0050.00316.51
7.4.240.0000.00716.69
7.4.230.0040.00416.59
7.4.220.0030.01416.48
7.4.210.0080.00616.65
7.4.200.0000.00716.80
7.4.190.0030.00316.77
7.4.160.0130.01016.46
7.4.150.0180.00717.40
7.4.140.0100.00817.86
7.4.130.0060.01416.61
7.4.120.0130.00716.63
7.4.110.0070.01016.71
7.4.100.0160.00916.77
7.4.90.0130.00316.50
7.4.80.0090.01319.37
7.4.70.0100.00616.70
7.4.60.0130.01016.67
7.4.50.0040.00416.38
7.4.40.0070.01022.52
7.4.30.0100.00716.57
7.4.00.0100.00315.17
7.3.330.0000.00513.17
7.3.320.0120.00013.27
7.3.310.0030.00316.26
7.3.300.0040.00416.39
7.3.290.0030.01216.42
7.3.280.0060.00916.40
7.3.270.0070.01117.40
7.3.260.0130.00618.24
7.3.250.0100.00616.58
7.3.240.0170.00316.52
7.3.230.0120.00616.52
7.3.210.0110.00616.42
7.3.200.0090.00919.39
7.3.190.0090.00716.46
7.3.180.0090.00616.56
7.3.170.0080.00816.70
7.3.160.0120.00316.65
7.3.120.0140.00314.96
7.3.10.0100.00316.81
7.3.00.0090.00016.40
7.2.330.0060.01316.86
7.2.320.0120.00916.78
7.2.310.0090.01016.75
7.2.300.0060.01016.73
7.2.290.0100.01016.92
7.2.130.0060.00616.88
7.2.120.0060.01016.80
7.2.110.0130.00317.10
7.2.100.0070.00716.91
7.2.90.0040.00817.03
7.2.80.0090.00617.14
7.2.70.0110.00317.02
7.2.60.0070.00416.63
7.2.50.0070.00717.07
7.2.40.0090.00616.99
7.2.30.0030.01016.93
7.2.20.0000.01216.93
7.2.10.0070.00716.89
7.2.00.0070.00418.25
7.1.250.0070.00715.84
7.1.200.0090.00615.94
7.1.100.0000.01118.16
7.1.70.0080.00017.27
7.1.60.0000.01017.01
7.1.50.0110.01117.05
7.1.00.0070.05322.48
7.0.200.0060.00916.85
7.0.140.0170.06022.07
7.0.60.0100.05720.00
7.0.50.0100.03317.98
7.0.40.0100.06020.13
7.0.30.0230.03320.09
7.0.20.0230.07320.32
7.0.10.0100.06720.08
7.0.00.0000.04320.06
5.6.280.0030.07320.99
5.6.210.0030.09020.54
5.6.200.0070.09018.18
5.6.190.0000.04720.59
5.6.180.0230.03720.41
5.6.170.0270.03720.71
5.6.160.0070.08020.47
5.6.150.0030.08318.24
5.6.140.0030.04018.14
5.6.130.0070.07718.27
5.6.120.0170.07720.99
5.6.110.0130.07721.04
5.6.100.0000.06321.00
5.6.90.0100.06320.95
5.6.80.0130.07720.38
5.5.350.4030.04720.34
5.5.340.0070.03717.95
5.5.330.0030.04020.35
5.5.320.0300.03020.27
5.5.310.0270.06320.38
5.5.300.0030.05017.94
5.5.290.0030.08717.94
5.5.280.0000.09020.82
5.5.270.0100.08320.87
5.5.260.0070.08320.80
5.5.250.0130.06720.79
5.5.240.0000.03720.15
5.4.450.0270.07719.31
5.4.440.0270.05719.55
5.4.430.0400.06019.49
5.4.420.0230.04319.31
5.4.410.0270.06719.14
5.4.400.0270.03719.32
5.4.390.0270.04319.22
5.4.380.0200.05318.98
5.4.370.0230.06318.85
5.4.360.0230.07719.21
5.4.350.0200.04718.83
5.4.340.0330.04319.09
5.4.320.0230.03719.06
5.4.310.0230.03319.00
5.4.300.0230.04319.09
5.4.290.0270.05019.19
5.4.280.0200.06319.21
5.4.270.0170.04018.88
5.4.260.0330.04019.23
5.4.250.0130.04319.14
5.4.240.0200.04318.80
5.4.230.0230.04719.05
5.4.220.0170.04019.18
5.4.210.0200.04019.05
5.4.200.0170.04018.86
5.4.190.0270.04719.30
5.4.180.0170.03719.23
5.4.170.0130.04319.23
5.4.160.0130.04718.97
5.4.150.0170.05319.14
5.4.140.0100.06016.52
5.4.130.0270.03716.38
5.4.120.0230.03316.35
5.4.110.0230.05316.56
5.4.100.0230.07016.45
5.4.90.0170.06016.36
5.4.80.0170.07316.27
5.4.70.0230.03316.24
5.4.60.0170.03316.43
5.4.50.0200.03716.53
5.4.40.0130.04016.51
5.4.30.0130.03716.42
5.4.20.0170.03316.34
5.4.10.0270.03016.43
5.4.00.0130.04015.80
5.3.290.0270.05014.66
5.3.280.0270.04014.68
5.3.270.0200.04314.62
5.3.260.0230.06714.60
5.3.250.0270.06714.52
5.3.240.0230.04014.58
5.3.230.0200.05714.62
5.3.220.0230.04014.68
5.3.210.0170.04014.54
5.3.200.0270.04014.79
5.3.190.0230.05714.80
5.3.180.0200.04014.56
5.3.170.0230.05014.55
5.3.160.0200.03714.56
5.3.150.0200.03714.79
5.3.140.0200.04314.68
5.3.130.0230.04014.48
5.3.120.0130.05014.70
5.3.110.0230.05714.67
5.3.100.0300.04714.08
5.3.90.0230.05714.17
5.3.80.0200.03714.04
5.3.70.0170.04314.25
5.3.60.0300.06314.03
5.3.50.0270.07013.96
5.3.40.0170.05714.11
5.3.30.0370.06014.03
5.3.20.0270.05013.71
5.3.10.0270.03713.58
5.3.00.0130.06713.73
5.2.170.0230.03012.25
5.2.160.0170.05712.25
5.2.150.0230.03712.25
5.2.140.0200.04012.25
5.2.130.0330.04712.25
5.2.120.0230.02712.25
5.2.110.0270.05312.25
5.2.100.0270.04012.25
5.2.90.0130.04312.25
5.2.80.0270.05312.25
5.2.70.0230.03012.25
5.2.60.0230.04712.25
5.2.50.0200.05012.25
5.2.40.0330.04712.25
5.2.30.0130.03312.25
5.2.20.0230.05312.25
5.2.10.0170.04012.25
5.2.00.0200.05012.25
5.1.60.0130.03712.25
5.1.50.0200.03712.25
5.1.40.0200.04312.25
5.1.30.0130.06012.25
5.1.20.0170.05312.25
5.1.10.0130.02712.25
5.1.00.0200.03012.25
5.0.50.0100.02712.25
5.0.40.0070.02712.25
5.0.30.0100.05312.25
5.0.20.0130.02312.25
5.0.10.0130.03712.25
5.0.00.0100.06312.25
4.4.90.0070.02712.25
4.4.80.0100.02012.25
4.4.70.0070.02012.25
4.4.60.0070.03012.25
4.4.50.0130.02712.25
4.4.40.0070.05312.25
4.4.30.0000.03012.25
4.4.20.0130.03312.25
4.4.10.0030.02312.25
4.4.00.0100.05312.25
4.3.110.0100.01312.25
4.3.100.0100.02012.25
4.3.90.0100.03312.25
4.3.80.0130.04712.25
4.3.70.0070.02712.25
4.3.60.0070.02312.25
4.3.50.0100.02312.25
4.3.40.0130.02312.25
4.3.30.0030.03012.25
4.3.20.0030.02012.25
4.3.10.0030.02012.25
4.3.00.0070.01712.25

preferences:
38.82 ms | 401 KiB | 5 Q