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 = ceil($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.0070.01016.75
8.3.50.0140.00321.91
8.3.40.0070.01019.03
8.3.30.0100.00319.21
8.3.20.0060.00320.25
8.3.10.0000.00823.61
8.3.00.0040.00419.07
8.2.180.0120.00618.53
8.2.170.0110.00422.96
8.2.160.0100.00320.51
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0070.00020.79
8.2.110.0000.00920.56
8.2.100.0110.00017.91
8.2.90.0040.00418.47
8.2.80.0040.00417.97
8.2.70.0090.00317.50
8.2.60.0000.00917.93
8.2.50.0030.00518.07
8.2.40.0000.01019.88
8.2.30.0080.00318.38
8.2.20.0000.00817.77
8.2.10.0070.00018.13
8.2.00.0000.00817.78
8.1.280.0070.00725.92
8.1.270.0120.00623.79
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00422.27
8.1.230.0090.00321.05
8.1.220.0000.00817.74
8.1.210.0080.00018.89
8.1.200.0090.00017.38
8.1.190.0000.01017.23
8.1.180.0080.00018.10
8.1.170.0030.00918.55
8.1.160.0040.00422.12
8.1.150.0040.00418.78
8.1.140.0040.00417.55
8.1.130.0030.00317.91
8.1.120.0000.00817.63
8.1.110.0040.00417.45
8.1.100.0040.00417.59
8.1.90.0030.00617.46
8.1.80.0060.00317.61
8.1.70.0000.00817.53
8.1.60.0040.00417.71
8.1.50.0030.00617.52
8.1.40.0040.00417.52
8.1.30.0000.00817.69
8.1.20.0040.00417.65
8.1.10.0040.00417.72
8.1.00.0040.00417.59
8.0.300.0040.00420.16
8.0.290.0080.00017.16
8.0.280.0000.00718.45
8.0.270.0070.00017.32
8.0.260.0030.00317.41
8.0.250.0030.00317.13
8.0.240.0040.00417.05
8.0.230.0070.00017.07
8.0.220.0000.00716.96
8.0.210.0070.00016.94
8.0.200.0030.00317.09
8.0.190.0000.00717.09
8.0.180.0050.00516.86
8.0.170.0080.00017.01
8.0.160.0040.00416.93
8.0.150.0000.00816.98
8.0.140.0050.00316.81
8.0.130.0060.00013.43
8.0.120.0030.00516.86
8.0.110.0030.00616.91
8.0.100.0040.00417.01
8.0.90.0030.00616.86
8.0.80.0080.00616.98
8.0.70.0020.00516.89
8.0.60.0030.00517.03
8.0.50.0000.00716.94
8.0.30.0080.01017.28
8.0.20.0110.00717.40
8.0.10.0070.00017.16
8.0.00.0110.00916.93
7.4.330.0000.00715.00
7.4.320.0040.00416.61
7.4.300.0000.00616.61
7.4.290.0000.00716.70
7.4.280.0050.00316.62
7.4.270.0070.00016.67
7.4.260.0000.00716.60
7.4.250.0000.00716.55
7.4.240.0020.00516.67
7.4.230.0040.00216.68
7.4.220.0030.01416.64
7.4.210.0060.00816.64
7.4.200.0070.00016.64
7.4.190.0040.00416.63
7.4.160.0040.01116.62
7.4.150.0100.00717.40
7.4.140.0030.01517.86
7.4.130.0130.00416.55
7.4.120.0130.00416.62
7.4.110.0120.01216.74
7.4.100.0100.01016.47
7.4.90.0070.01016.48
7.4.80.0180.00919.39
7.4.70.0130.01016.64
7.4.60.0110.00616.70
7.4.50.0000.00916.81
7.4.40.0050.01016.64
7.4.30.0000.01516.53
7.4.10.0120.01216.51
7.4.00.0080.00915.59
7.3.330.0030.00313.17
7.3.320.0030.00313.29
7.3.310.0000.00716.43
7.3.300.0040.00416.46
7.3.290.0030.01616.45
7.3.280.0070.01116.45
7.3.270.0120.01217.40
7.3.260.0160.01016.59
7.3.250.0080.01016.57
7.3.240.0100.01016.47
7.3.230.0030.01416.70
7.3.210.0070.01416.54
7.3.200.0140.00419.39
7.3.190.0090.01316.55
7.3.180.0100.00616.63
7.3.170.0120.00616.45
7.3.160.0060.00916.39
7.3.130.0080.01116.34
7.3.120.0100.00815.27
7.3.110.0080.01015.46
7.3.100.0080.01015.69
7.3.90.0090.00715.51
7.3.80.0050.01315.68
7.3.70.0110.00615.53
7.3.60.0040.00915.55
7.3.50.0030.01315.69
7.3.40.0050.01015.67
7.3.30.0020.01015.54
7.3.20.0100.00917.38
7.3.10.0080.00617.47
7.3.00.0070.01217.33
7.2.330.0140.00316.77
7.2.320.0160.00616.65
7.2.310.0110.00216.71
7.2.300.0130.00316.49
7.2.290.0160.00016.61
7.2.260.0060.01016.33
7.2.250.0100.01215.89
7.2.240.0100.00915.83
7.2.230.0090.00815.82
7.2.220.0080.00816.00
7.2.210.0020.01115.90
7.2.200.0070.00815.86
7.2.190.0050.00815.88
7.2.180.0050.00915.79
7.2.170.0070.01015.76
7.2.160.0090.00616.68
7.2.150.0140.00718.40
7.2.140.0090.00918.46
7.2.130.0040.01318.24
7.2.120.0060.00918.21
7.2.110.0040.01718.65
7.2.100.0090.00618.50
7.2.90.0080.00818.32
7.2.80.0100.00718.41
7.2.70.0070.01018.38
7.2.60.0060.00918.45
7.2.50.0040.00818.51
7.2.40.0090.00918.39
7.2.30.0070.00718.46
7.2.20.0040.01218.74
7.2.10.0060.01518.37
7.2.00.0060.01018.91
7.1.330.0100.00716.64
7.1.320.0080.00416.67
7.1.310.0080.00516.55
7.1.300.0030.00716.46
7.1.290.0050.00716.63
7.1.280.0040.01316.67
7.1.270.0090.00916.49
7.1.260.0130.00416.57
7.1.250.0080.01217.48
7.1.240.0150.00717.30
7.1.230.0110.00717.32
7.1.220.0040.01117.41
7.1.210.0100.00617.32
7.1.200.0100.00317.35
7.1.190.0040.00717.36
7.1.180.0150.00317.46
7.1.170.0100.00717.35
7.1.160.0030.01317.25
7.1.150.0100.00617.48
7.1.140.0030.01217.43
7.1.130.0050.01917.25
7.1.120.0090.00617.16
7.1.110.0130.00617.40
7.1.100.0040.00817.80
7.1.90.0060.00617.24
7.1.80.0070.01017.08
7.1.70.0070.00417.20
7.1.60.0080.01118.45
7.1.50.0090.00817.13
7.1.40.0040.01217.30
7.1.30.0060.01017.32
7.1.20.0030.00917.16
7.1.10.0100.00317.43
7.1.00.0020.04419.93
7.0.330.0110.00716.95
7.0.320.0100.00317.10
7.0.310.0090.00617.16
7.0.300.0090.00617.10
7.0.290.0070.01017.04
7.0.280.0090.00617.03
7.0.270.0030.01417.13
7.0.260.0110.00717.15
7.0.250.0090.00616.87
7.0.240.0120.00017.09
7.0.230.0140.00417.15
7.0.220.0080.00817.11
7.0.210.0070.01016.93
7.0.200.0070.00416.92
7.0.190.0100.00717.08
7.0.180.0140.00416.99
7.0.170.0100.00716.86
7.0.160.0090.00316.97
7.0.150.0120.00016.99
7.0.140.0050.04419.68
7.0.130.0000.01116.84
7.0.120.0030.01417.04
7.0.110.0100.00716.88
7.0.100.0090.00916.79
7.0.90.0070.01316.89
7.0.80.0250.04518.38
7.0.70.0260.04418.42
7.0.60.0170.04518.49
7.0.50.0330.04218.57
7.0.40.0050.04717.51
7.0.30.0050.04717.57
7.0.20.0050.03017.41
7.0.10.0070.02417.51
7.0.00.0080.04717.51
5.6.400.0040.01915.86
5.6.390.0050.01315.82
5.6.380.0070.01016.35
5.6.370.0040.01116.11
5.6.360.0090.00615.99
5.6.350.0060.00615.65
5.6.340.0000.01616.46
5.6.330.0000.01216.13
5.6.320.0060.00816.02
5.6.310.0070.00715.87
5.6.300.0030.01315.93
5.6.290.0130.00016.36
5.6.280.0050.03818.55
5.6.270.0030.01315.87
5.6.260.0140.00715.71
5.6.250.0060.01215.81
5.6.240.0070.00315.70
5.6.230.0100.02318.10
5.6.220.0050.04718.14
5.6.210.0070.02918.33
5.6.200.0150.04218.39
5.6.190.0050.04318.61
5.6.180.0080.03718.53
5.6.170.0070.04518.53
5.6.160.0050.05218.51
5.6.150.0050.04118.54
5.6.140.0050.05018.38
5.6.130.0100.04518.57
5.6.120.0090.04718.51
5.6.110.0080.04618.55
5.6.100.0140.03218.47
5.6.90.0080.04818.59
5.6.80.0080.02818.17
5.6.70.0030.03218.13
5.6.60.0090.04518.04
5.6.50.0150.04218.13
5.6.40.0090.04618.14
5.6.30.0120.04218.14
5.6.20.0060.05018.21
5.6.10.0140.04018.17
5.6.00.0110.04618.32
5.5.380.0030.00915.98
5.5.370.0090.04318.14
5.5.360.0050.04518.09
5.5.350.0090.04318.20
5.5.340.0080.03318.51
5.5.330.0080.04518.32
5.5.320.0100.04318.39
5.5.310.0050.04618.51
5.5.300.0120.04118.26
5.5.290.0100.04018.46
5.5.280.0040.04418.35
5.5.270.0110.04518.51
5.5.260.0140.04218.48
5.5.250.0140.03818.30
5.5.240.0110.04017.99
5.5.230.0050.04217.96
5.5.220.0030.04518.11
5.5.210.0070.02718.11
5.5.200.0030.03818.15
5.5.190.0070.04317.95
5.5.180.0110.04118.05
5.5.170.0150.00316.04
5.5.160.0070.04717.98
5.5.150.0110.02118.03
5.5.140.0130.03618.05
5.5.130.0080.04318.01
5.5.120.0050.04518.03
5.5.110.0080.04318.03
5.5.100.0100.04117.93
5.5.90.0050.03417.94
5.5.80.0070.04518.04
5.5.70.0090.04117.95
5.5.60.0050.04417.87
5.5.50.0040.03017.96
5.5.40.0050.04518.11
5.5.30.0020.02918.05
5.5.20.0020.02918.03
5.5.10.0090.03218.02
5.5.00.0110.03617.92
5.4.450.0060.02716.10
5.4.440.0080.03816.12
5.4.430.0100.03716.17
5.4.420.0030.04416.28
5.4.410.0050.04416.14
5.4.400.0060.03116.05
5.4.390.0020.02616.09
5.4.380.0020.04615.95
5.4.370.0080.03116.00
5.4.360.0020.04715.98
5.4.350.0050.03715.88
5.4.340.0070.04216.04
5.4.330.0030.00612.83
5.4.320.0040.04916.03
5.4.310.0130.02515.88
5.4.300.0050.04416.10
5.4.290.0050.03415.86
5.4.280.0050.04116.02
5.4.270.0050.04315.86
5.4.260.0080.04015.84
5.4.250.0050.04215.95
5.4.240.0090.03515.84
5.4.230.0070.03815.88
5.4.220.0100.03915.92
5.4.210.0060.03315.89
5.4.200.0050.04215.88
5.4.190.0000.03615.83
5.4.180.0090.03916.12
5.4.170.0070.02815.85
5.4.160.0070.02516.02
5.4.150.0130.03515.89
5.4.140.0100.03814.78
5.4.130.0080.02514.76
5.4.120.0140.03214.63
5.4.110.0080.04014.57
5.4.100.0090.02214.59
5.4.90.0050.02414.54
5.4.80.0070.04014.70
5.4.70.0090.02914.57
5.4.60.0030.02214.63
5.4.50.0050.03314.68
5.4.40.0100.03014.64
5.4.30.0090.03214.56
5.4.20.0060.02114.64
5.4.10.0100.04114.65
5.4.00.0090.02414.42
5.3.290.0150.03713.88
5.3.280.0090.04613.81
5.3.270.0050.04614.00
5.3.260.0100.03713.87
5.3.250.0050.04514.04
5.3.240.0080.04513.85
5.3.230.0120.04313.89
5.3.220.0080.02913.77
5.3.210.0080.02713.79
5.3.200.0120.03013.82
5.3.190.0100.04013.83
5.3.180.0080.02613.77
5.3.170.0070.03813.91
5.3.160.0080.03313.91
5.3.150.0140.03213.98
5.3.140.0080.04413.95
5.3.130.0120.02514.01
5.3.120.0050.02813.94
5.3.110.0080.02413.83
5.3.100.0090.02113.72
5.3.90.0030.03013.55
5.3.80.0100.02113.47
5.3.70.0090.02313.43
5.3.60.0080.02713.49
5.3.50.0000.03113.40
5.3.40.0070.02413.41
5.3.30.0090.02313.46
5.3.20.0090.02213.26
5.3.10.0040.02813.19
5.3.00.0110.02013.15
5.2.170.0030.03011.61
5.2.160.0070.02711.61
5.2.150.0000.03311.61
5.2.140.0030.03011.61
5.2.130.0030.02711.61
5.2.120.0030.02711.61
5.2.110.0000.03011.61
5.2.100.0070.02711.61
5.2.90.0000.03011.61
5.2.80.0070.03011.61
5.2.70.0130.04711.61
5.2.60.0000.03711.61
5.2.50.0070.04011.61
5.2.40.0070.05711.61
5.2.30.0030.05311.61
5.2.20.0000.04711.61
5.2.10.0030.03011.61
5.2.00.0000.03011.61
5.1.60.0130.01711.61
5.1.50.0000.02711.61
5.1.40.0030.02711.61
5.1.30.0000.04011.61
5.1.20.0000.02711.61
5.1.10.0030.03011.61
5.1.00.0030.04311.61
5.0.50.0030.01711.61
5.0.40.0000.03311.61
5.0.30.0000.02711.61
5.0.20.0030.01711.61
5.0.10.0000.02011.61
5.0.00.0030.02711.61
4.4.90.0000.01311.61
4.4.80.0030.01711.61
4.4.70.0030.03311.61
4.4.60.0030.03311.61
4.4.50.0000.03011.61
4.4.40.0030.03711.61
4.4.30.0070.01711.61
4.4.20.0000.01711.61
4.4.10.0070.01011.61
4.4.00.0000.02711.61
4.3.110.0030.01711.61
4.3.100.0000.01711.61
4.3.90.0030.01311.61
4.3.80.0030.02011.61
4.3.70.0000.01711.61
4.3.60.0000.02011.61
4.3.50.0000.01711.61
4.3.40.0000.02311.61
4.3.30.0000.01711.61
4.3.20.0000.01711.61
4.3.10.0000.02311.61
4.3.00.0000.01711.61

preferences:
50.69 ms | 400 KiB | 5 Q