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);*/ function flip90($arr, $lineHeight) { $tbl = array(); $index = 0; $counter = 1; for($i = 0; $i < count($arr); $i++) { if($counter > $lineHeight) { $index++; $counter = 1; } if($counter <= $lineHeight) { $tbl[$index][$counter] = $arr[$i]; $counter++; } } return $tbl; } $flipped = flip90($data, 5); echo "<pre>"; var_dump($flipped); echo "<pre>";

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.00718.55
8.3.50.0120.00722.11
8.3.40.0070.00718.85
8.3.30.0070.01118.69
8.3.20.0000.00818.77
8.3.10.0050.00320.47
8.3.00.0040.00723.39
8.2.180.0070.01116.88
8.2.170.0120.00622.96
8.2.160.0030.01422.27
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0080.00019.61
8.2.110.0140.00420.87
8.2.100.0070.00317.91
8.2.90.0000.00819.39
8.2.80.0030.00617.97
8.2.70.0000.00817.50
8.2.60.0050.00318.04
8.2.50.0000.00918.07
8.2.40.0040.00418.22
8.2.30.0040.00419.91
8.2.20.0000.00917.67
8.2.10.0000.00817.63
8.2.00.0050.00317.76
8.1.280.0140.00425.92
8.1.270.0160.00623.99
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0190.00022.54
8.1.230.0040.00720.88
8.1.220.0040.00418.77
8.1.210.0040.00418.90
8.1.200.0060.00317.35
8.1.190.0040.00417.65
8.1.180.0030.00618.10
8.1.170.0040.00418.81
8.1.160.0050.00318.82
8.1.150.0050.00318.69
8.1.140.0040.00417.38
8.1.130.0000.00717.80
8.1.120.0030.00517.46
8.1.110.0030.00517.41
8.1.100.0000.00817.45
8.1.90.0030.00617.42
8.1.80.0040.00417.44
8.1.70.0000.00717.48
8.1.60.0030.00617.56
8.1.50.0040.00417.45
8.1.40.0080.00017.59
8.1.30.0030.00617.56
8.1.20.0090.00017.68
8.1.10.0000.00817.55
8.1.00.0040.00417.38
8.0.300.0050.00519.98
8.0.290.0040.00416.75
8.0.280.0030.00518.42
8.0.270.0030.00317.32
8.0.260.0000.00716.84
8.0.250.0040.00416.94
8.0.240.0000.01016.93
8.0.230.0000.01016.91
8.0.220.0030.00316.80
8.0.210.0070.00016.82
8.0.200.0000.00716.77
8.0.190.0040.00416.76
8.0.180.0040.00416.89
8.0.170.0000.00916.91
8.0.160.0050.00316.90
8.0.150.0080.00016.86
8.0.140.0040.00416.76
8.0.130.0030.00313.39
8.0.120.0050.00316.75
8.0.110.0030.00317.01
8.0.100.0050.00216.76
8.0.90.0040.00416.92
8.0.80.0150.00616.86
8.0.70.0000.00716.86
8.0.60.0040.00416.96
8.0.50.0080.00016.76
8.0.30.0090.01616.94
8.0.20.0130.01017.40
8.0.10.0040.00416.91
8.0.00.0130.00716.86
7.4.330.0050.00014.77
7.4.320.0060.00016.53
7.4.300.0030.00316.62
7.4.290.0000.00716.64
7.4.280.0040.00416.50
7.4.270.0080.00016.63
7.4.260.0030.00313.30
7.4.250.0090.00016.40
7.4.240.0040.00416.62
7.4.230.0030.00316.68
7.4.220.0070.01116.62
7.4.210.0080.00816.53
7.4.200.0000.00716.50
7.4.190.0050.00316.48
7.4.160.0100.00716.63
7.4.150.0030.01717.40
7.4.140.0130.00817.86
7.4.130.0130.00516.49
7.4.120.0100.00816.59
7.4.110.0060.01216.56
7.4.100.0120.01216.50
7.4.90.0160.00416.40
7.4.80.0100.00719.04
7.4.70.0030.01416.36
7.4.60.0090.00916.40
7.4.50.0030.00316.43
7.4.40.0150.00022.27
7.4.30.0030.01216.54
7.4.00.0060.01114.74
7.3.330.0000.00513.15
7.3.320.0030.00313.34
7.3.310.0000.00716.35
7.3.300.0070.00016.25
7.3.290.0000.01416.37
7.3.280.0090.00916.36
7.3.270.0090.00817.40
7.3.260.0070.01418.24
7.3.250.0070.01216.44
7.3.240.0130.00716.55
7.3.230.0100.01016.71
7.3.210.0100.00716.35
7.3.200.0000.01819.39
7.3.190.0100.00716.69
7.3.180.0120.00916.43
7.3.170.0150.00716.37
7.3.160.0140.00716.40
7.3.120.0070.01014.64
7.3.110.0030.01315.10
7.3.100.0000.01714.67
7.3.90.0090.00914.97
7.3.80.0070.00715.11
7.3.70.0120.00314.80
7.3.60.0090.00614.62
7.3.50.0100.00714.61
7.3.40.0040.01114.63
7.3.30.0160.00014.68
7.3.20.0110.00416.62
7.3.10.0030.00716.59
7.3.00.0060.00816.65
7.2.330.0120.00616.71
7.2.320.0080.01516.51
7.2.310.0090.00916.54
7.2.300.0130.00316.59
7.2.290.0180.00016.79
7.2.250.0120.00315.25
7.2.240.0030.01215.29
7.2.230.0060.01315.08
7.2.220.0060.00315.06
7.2.210.0040.00815.17
7.2.200.0030.01015.02
7.2.190.0090.00614.97
7.2.180.0040.01115.12
7.2.170.0060.00915.04
7.2.130.0080.00416.74
7.2.120.0070.00717.12
7.2.110.0060.00616.88
7.2.100.0070.00316.78
7.2.90.0070.00316.98
7.2.80.0090.00016.69
7.2.70.0030.00716.67
7.2.60.0060.00916.55
7.2.50.0030.00717.05
7.2.40.0000.01016.74
7.2.30.0030.01017.02
7.2.20.0030.01016.81
7.2.10.0070.00716.93
7.2.00.0080.00617.97
7.1.330.0030.01315.66
7.1.320.0070.01016.09
7.1.310.0040.01115.60
7.1.300.0070.00715.80
7.1.290.0000.01115.45
7.1.280.0000.01315.86
7.1.270.0030.00915.81
7.1.260.0000.01115.94
7.1.250.0060.00915.87
7.1.100.0070.00718.16
7.1.70.0000.00717.20
7.1.60.0120.01219.40
7.1.50.0060.01216.98
7.1.00.0070.07322.37
7.0.200.0040.00416.69
7.0.140.0000.07722.12
7.0.60.0030.04019.93
7.0.50.0000.08717.87
7.0.40.0070.04020.40
7.0.30.0430.05720.34
7.0.20.0270.08020.19
7.0.10.0070.04020.15
7.0.00.0230.07320.05
5.6.280.0100.06720.82
5.6.210.0030.07320.63
5.6.200.0200.03318.14
5.6.190.0030.04320.61
5.6.180.0270.07720.33
5.6.170.0300.07720.51
5.6.160.0030.06020.48
5.6.150.0030.04018.14
5.6.140.0070.05718.21
5.6.130.0070.08718.28
5.6.120.0100.04321.00
5.6.110.0270.06021.01
5.6.100.0130.06020.89
5.6.90.0030.04020.98
5.6.80.0070.07720.51
5.6.70.0230.07320.51
5.5.350.3930.04320.30
5.5.340.0030.08718.03
5.5.330.0100.07020.42
5.5.320.0000.05020.36
5.5.310.0270.05020.37
5.5.300.0100.03317.98
5.5.290.0030.07017.98
5.5.280.0030.05020.86
5.5.270.0130.07720.65
5.5.260.0170.07720.88
5.5.250.0070.08720.59
5.5.240.0070.07020.17
5.4.450.0100.06019.17
5.4.440.0000.05719.57
5.4.430.0070.06019.46
5.4.420.0230.06719.46
5.4.410.0070.07319.44
5.4.400.0100.04019.02
5.4.390.0000.04718.87
5.4.380.0030.03719.00
5.4.370.0000.04018.85
5.4.360.0030.03719.24
5.4.350.0070.03319.08
5.4.340.0030.03718.98
5.4.320.0030.03718.88
5.4.310.0030.04019.08
5.4.300.0030.03719.15
5.4.290.0030.03719.23
5.4.280.0030.03719.12
5.4.270.0030.03719.24
5.4.260.0070.03319.14
5.4.250.0100.03318.84
5.4.240.0070.03318.86
5.4.230.0070.03718.86
5.4.220.0070.03319.14
5.4.210.0030.03719.08
5.4.200.0070.03318.84
5.4.190.0070.03319.20
5.4.180.0030.04018.96
5.4.170.0030.03719.15
5.4.160.0070.03318.83
5.4.150.0030.05019.22
5.4.140.0000.05316.50
5.4.130.0130.05316.38
5.4.120.0070.07016.35
5.4.110.0070.07716.43
5.4.100.0000.05316.41
5.4.90.0070.07016.41
5.4.80.0030.04316.41
5.4.70.0030.05716.28
5.4.60.0070.07016.37
5.4.50.0030.06316.27
5.4.40.0100.06716.36
5.4.30.0070.06716.33
5.4.20.0130.07016.35
5.4.10.0070.07316.27
5.4.00.0100.06715.86
5.3.290.0000.05314.72
5.3.280.0070.03314.61
5.3.270.0030.03714.63
5.3.260.0070.03314.63
5.3.250.0000.04014.64
5.3.240.0130.07014.62
5.3.230.0130.06714.77
5.3.220.0070.04714.62
5.3.210.0070.08014.73
5.3.200.0030.05314.60
5.3.190.0130.06714.57
5.3.180.0100.03714.59
5.3.170.0070.08014.60
5.3.160.0070.07714.56
5.3.150.0030.06714.71
5.3.140.0070.07314.55
5.3.130.0030.05714.71
5.3.120.0070.08314.56
5.3.110.0030.07014.55
5.3.100.0030.08314.07
5.3.90.0100.07714.01
5.3.80.0030.06014.09
5.3.70.0130.05713.98
5.3.60.0070.07313.95
5.3.50.0130.06713.95
5.3.40.0070.04713.92
5.3.30.0130.06713.86
5.3.20.0070.07713.75
5.3.10.0030.05713.80
5.3.00.0000.06013.67
5.2.170.0070.06711.15
5.2.160.0100.05711.18
5.2.150.0030.06711.17
5.2.140.0170.02311.09
5.2.130.0100.06011.16
5.2.120.0100.05711.11
5.2.110.0100.05711.11
5.2.100.0070.06311.25
5.2.90.0130.05011.10
5.2.80.0070.06311.05
5.2.70.0170.03011.08
5.2.60.0030.04711.20
5.2.50.0070.06010.97
5.2.40.0130.04710.88
5.2.30.0000.04310.98
5.2.20.0030.03010.99
5.2.10.0000.06010.82
5.2.00.0030.06010.88
5.1.60.0000.0339.91
5.1.50.0070.0309.95
5.1.40.0130.04310.12
5.1.30.0030.06010.23
5.1.20.0070.04710.50
5.1.10.0070.0439.98
5.1.00.0100.05010.12
5.0.50.0030.0238.61
5.0.40.0030.0478.56
5.0.30.0030.0608.33
5.0.20.0000.0478.33
5.0.10.0000.0238.33
5.0.00.0030.0638.33
4.4.90.0030.0378.33
4.4.80.0000.0338.33
4.4.70.0030.0178.33
4.4.60.0030.0378.33
4.4.50.0030.0378.33
4.4.40.0030.0578.33
4.4.30.0000.0278.33
4.4.20.0130.0338.33
4.4.10.0000.0278.33
4.4.00.0000.0278.33
4.3.110.0030.0208.33
4.3.100.0000.0378.33
4.3.90.0030.0338.33
4.3.80.0000.0608.33
4.3.70.0030.0378.33
4.3.60.0030.0308.33
4.3.50.0070.0238.33
4.3.40.0070.0508.33
4.3.30.0000.0378.33
4.3.20.0000.0378.33
4.3.10.0030.0338.33
4.3.00.0000.0408.33

preferences:
71.44 ms | 401 KiB | 5 Q