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>"; print_r($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.0120.00318.43
8.3.50.0100.00521.99
8.3.40.0090.00618.84
8.3.30.0120.00318.90
8.3.20.0030.00618.73
8.3.10.0090.00921.15
8.3.00.0120.00623.53
8.2.180.0130.00316.63
8.2.170.0070.01422.96
8.2.160.0090.01220.52
8.2.150.0120.00624.18
8.2.140.0060.01324.66
8.2.130.0070.01126.16
8.2.120.0080.00019.79
8.2.110.0090.00921.06
8.2.100.0090.00317.97
8.2.90.0040.00419.20
8.2.80.0060.00317.97
8.2.70.0060.00317.50
8.2.60.0060.00318.03
8.2.50.0050.00318.10
8.2.40.0040.00418.28
8.2.30.0000.00821.09
8.2.20.0030.00517.67
8.2.10.0040.00417.64
8.2.00.0030.00517.71
8.1.280.0040.01825.92
8.1.270.0140.00423.99
8.1.260.0100.01026.35
8.1.250.0000.00828.09
8.1.240.0030.00622.73
8.1.230.0040.00820.21
8.1.220.0080.00017.74
8.1.210.0000.00918.77
8.1.200.0030.00717.35
8.1.190.0000.00817.35
8.1.180.0050.00318.10
8.1.170.0040.00418.66
8.1.160.0050.00218.91
8.1.150.0060.00318.70
8.1.140.0000.00817.46
8.1.130.0050.00217.90
8.1.120.0030.00317.37
8.1.110.0040.00417.45
8.1.100.0000.00717.53
8.1.90.0000.00717.36
8.1.80.0040.00417.52
8.1.70.0000.00717.45
8.1.60.0040.00417.48
8.1.50.0000.00717.38
8.1.40.0040.00417.51
8.1.30.0040.00417.66
8.1.20.0000.00817.65
8.1.10.0040.00417.50
8.1.00.0040.00417.49
8.0.300.0080.00018.77
8.0.290.0050.00316.63
8.0.280.0070.00018.48
8.0.270.0070.00017.19
8.0.260.0030.00316.83
8.0.250.0040.00416.91
8.0.240.0030.00516.79
8.0.230.0000.00816.89
8.0.220.0000.00916.89
8.0.210.0040.00416.85
8.0.200.0000.00716.88
8.0.190.0040.00416.78
8.0.180.0040.00416.89
8.0.170.0050.00316.82
8.0.160.0080.00016.84
8.0.150.0040.00416.87
8.0.140.0060.00616.87
8.0.130.0030.00313.25
8.0.120.0000.00716.83
8.0.110.0000.00816.68
8.0.100.0000.00716.96
8.0.90.0000.00716.82
8.0.80.0040.01216.93
8.0.70.0080.00016.99
8.0.60.0030.00516.96
8.0.50.0080.00016.95
8.0.30.0120.00917.10
8.0.20.0080.01017.40
8.0.10.0040.00417.03
8.0.00.0110.01016.67
7.4.330.0030.00314.77
7.4.320.0040.00416.57
7.4.300.0070.00016.56
7.4.290.0000.00716.50
7.4.280.0000.00816.50
7.4.270.0030.00316.61
7.4.260.0000.00613.25
7.4.250.0000.00716.56
7.4.240.0040.00416.47
7.4.230.0070.00016.61
7.4.220.0040.01216.63
7.4.210.0080.00716.59
7.4.200.0030.00516.68
7.4.190.0070.00016.68
7.4.160.0120.00416.41
7.4.150.0110.00817.40
7.4.140.0060.01517.86
7.4.130.0100.00716.46
7.4.120.0100.00716.50
7.4.110.0070.01016.47
7.4.100.0130.00916.32
7.4.90.0060.01216.50
7.4.80.0030.01319.37
7.4.70.0130.01116.46
7.4.60.0090.00916.28
7.4.50.0000.00916.56
7.4.40.0080.00822.52
7.4.30.0090.00716.49
7.4.10.0060.00915.08
7.4.00.0040.01114.95
7.3.330.0050.00013.31
7.3.320.0030.00313.38
7.3.310.0030.00416.27
7.3.300.0030.00316.34
7.3.290.0130.00316.39
7.3.280.0090.00716.40
7.3.270.0100.01317.40
7.3.260.0100.00718.24
7.3.250.0070.01416.34
7.3.240.0120.00616.63
7.3.230.0120.00616.53
7.3.210.0110.00616.62
7.3.200.0090.01219.39
7.3.190.0110.00716.64
7.3.180.0090.00616.64
7.3.170.0030.01716.43
7.3.160.0080.00816.56
7.3.130.0080.01215.02
7.3.120.0060.01014.87
7.3.110.0110.00714.65
7.3.100.0070.00714.57
7.3.90.0000.01014.98
7.3.80.0060.00314.93
7.3.70.0090.00014.63
7.3.60.0000.01014.75
7.3.50.0100.00614.81
7.3.40.0030.00714.86
7.3.30.0100.00714.53
7.3.20.0170.00016.62
7.3.10.0100.00716.73
7.3.00.0070.00716.56
7.2.330.0140.01216.77
7.2.320.0090.00816.47
7.2.310.0060.01316.81
7.2.300.0000.01616.82
7.2.290.0110.01416.43
7.2.260.0070.01115.22
7.2.250.0040.01114.94
7.2.240.0030.01014.67
7.2.230.0110.00715.08
7.2.220.0090.00914.99
7.2.210.0040.00815.20
7.2.200.0030.00714.98
7.2.190.0070.00715.11
7.2.180.0110.00715.04
7.2.170.0060.00615.18
7.2.160.0030.00715.21
7.2.150.0090.00616.97
7.2.140.0090.00617.15
7.2.130.0060.01016.95
7.2.120.0060.00617.06
7.2.110.0090.00316.77
7.2.100.0090.00616.97
7.2.90.0070.00717.05
7.2.80.0060.00917.04
7.2.70.0130.00616.76
7.2.60.0060.01316.95
7.2.50.0070.01016.89
7.2.40.0130.00316.93
7.2.30.0000.01217.10
7.2.20.0040.01116.79
7.2.10.0000.01217.05
7.2.00.0080.00918.23
7.1.330.0030.01015.75
7.1.320.0000.01816.07
7.1.310.0080.00316.00
7.1.300.0070.01015.59
7.1.290.0110.00415.85
7.1.280.0060.00615.58
7.1.270.0000.01515.63
7.1.260.0000.01215.88
7.1.250.0040.00815.80
7.1.240.0000.01515.86
7.1.230.0070.00715.92
7.1.220.0080.00415.53
7.1.210.0030.00715.47
7.1.200.0060.01015.61
7.1.190.0000.01515.79
7.1.180.0060.00315.67
7.1.170.0070.00715.96
7.1.160.0030.01015.73
7.1.150.0060.00615.82
7.1.140.0000.01615.73
7.1.130.0110.00015.73
7.1.120.0060.00915.95
7.1.110.0100.00315.73
7.1.100.0060.00816.88
7.1.90.0090.00315.85
7.1.80.0060.00615.77
7.1.70.0040.00716.47
7.1.60.0100.00917.66
7.1.50.0060.00916.39
7.1.40.0100.00315.91
7.1.30.0000.01315.90
7.1.20.0060.00915.62
7.1.10.0040.00715.51
7.1.00.0080.03319.10
7.0.330.0040.01115.40
7.0.320.0080.00415.25
7.0.310.0030.01415.28
7.0.300.0100.00715.39
7.0.290.0030.01415.25
7.0.280.0000.01215.43
7.0.270.0170.00015.13
7.0.260.0100.00615.25
7.0.250.0000.01515.47
7.0.240.0070.00715.48
7.0.230.0000.01515.23
7.0.220.0090.00915.27
7.0.210.0030.01015.14
7.0.200.0010.01015.96
7.0.190.0090.00615.51
7.0.180.0140.00015.26
7.0.170.0040.00815.10
7.0.160.0000.01415.18
7.0.150.0100.00315.16
7.0.140.0050.04218.88
7.0.130.0030.01015.39
7.0.120.0070.00715.71
7.0.110.0070.00715.59
7.0.100.0000.01215.66
7.0.90.0060.00915.48
7.0.80.0060.00615.18
7.0.70.0120.00315.48
7.0.60.0050.02217.73
7.0.50.0070.02216.78
7.0.40.0090.02215.71
7.0.30.0070.02015.63
7.0.20.0020.02815.54
7.0.10.0080.02215.62
7.0.00.0070.02015.63
5.6.400.0060.01214.26
5.6.390.0000.01414.48
5.6.380.0000.01314.45
5.6.370.0060.01014.26
5.6.360.0110.00814.79
5.6.350.0030.01014.38
5.6.340.0040.01114.35
5.6.330.0130.00314.62
5.6.320.0090.00314.11
5.6.310.0070.01014.47
5.6.300.0070.01414.80
5.6.290.0030.00914.38
5.6.280.0050.04317.76
5.6.270.0060.01014.88
5.6.260.0060.00914.55
5.6.250.0070.01014.16
5.6.240.0030.00914.25
5.6.230.0070.01114.55
5.6.220.0070.00714.53
5.6.210.0080.04117.53
5.6.200.0130.04216.29
5.6.190.0050.02516.19
5.6.180.0020.02716.47
5.6.170.0080.02116.33
5.6.160.0050.02116.43
5.6.150.0070.02216.44
5.6.140.0070.02316.33
5.6.130.0050.02416.26
5.6.120.0050.02516.47
5.6.110.0040.02416.38
5.6.100.0030.02716.35
5.6.90.0050.02516.24
5.6.80.0080.02015.75
5.6.70.0040.02415.91
5.6.60.0030.02316.03
5.6.50.0020.02415.87
5.6.40.0100.02115.98
5.6.30.0070.02016.02
5.6.20.0090.03216.15
5.6.10.0050.04216.10
5.6.00.0120.04015.93
5.5.380.0030.00714.29
5.5.370.0000.01214.36
5.5.360.0070.01114.41
5.5.350.0020.04917.29
5.5.340.0070.04516.29
5.5.330.0010.03116.34
5.5.320.0100.02116.31
5.5.310.0050.02516.20
5.5.300.0050.02516.17
5.5.290.0030.02716.14
5.5.280.0100.01816.26
5.5.270.0060.02216.33
5.5.260.0040.02316.38
5.5.250.0040.02416.01
5.5.240.0050.02315.84
5.5.230.0110.02115.83
5.5.220.0060.02315.89
5.5.210.0060.02115.75
5.5.200.0050.02015.71
5.5.190.0050.02015.91
5.5.180.0060.03715.72
5.5.170.0040.01114.34
5.5.160.0030.03115.88
5.5.150.0030.03715.79
5.5.140.0120.03215.84
5.5.130.0120.03515.97
5.5.120.0070.04015.71
5.5.110.0070.04115.82
5.5.100.0080.02215.75
5.5.90.0100.03115.86
5.5.80.0090.03415.87
5.5.70.0000.03315.70
5.5.60.0080.02615.73
5.5.50.0100.02515.82
5.5.40.0070.02815.67
5.5.30.0080.02715.74
5.5.20.0110.03815.75
5.5.10.0080.02715.70
5.5.00.0020.03115.76
5.4.450.0070.01915.36
5.4.440.0100.01815.32
5.4.430.0020.02415.39
5.4.420.0070.02215.24
5.4.410.0060.02215.34
5.4.400.0060.02015.14
5.4.390.0030.02015.19
5.4.380.0050.02015.12
5.4.370.0100.01815.07
5.4.360.0030.03015.13
5.4.350.0020.02514.89
5.4.340.0080.02115.12
5.4.330.0000.01111.16
5.4.320.0100.03515.12
5.4.310.0150.03215.12
5.4.300.0100.03014.89
5.4.290.0050.03915.00
5.4.280.0000.03415.10
5.4.270.0050.04515.12
5.4.260.0050.02815.17
5.4.250.0060.02515.08
5.4.240.0070.02015.27
5.4.230.0140.03215.06
5.4.220.0060.02315.01
5.4.210.0050.02715.02
5.4.200.0040.03915.11
5.4.190.0030.03514.94
5.4.180.0080.04015.04
5.4.170.0100.03114.98
5.4.160.0070.03014.88
5.4.150.0070.04014.98
5.4.140.0130.03313.69
5.4.130.0080.02313.78
5.4.120.0030.02813.82
5.4.110.0100.03713.74
5.4.100.0050.03813.54
5.4.90.0100.03713.52
5.4.80.0100.03613.71
5.4.70.0090.03513.62
5.4.60.0060.02513.73
5.4.50.0050.03813.74
5.4.40.0080.02313.81
5.4.30.0080.04013.64
5.4.20.0030.02513.62
5.4.10.0100.03713.65
5.4.00.0060.04313.56
5.3.290.0020.04712.73
5.3.280.0070.03512.47
5.3.270.0070.02012.62
5.3.260.0050.03012.58
5.3.250.0040.04112.72
5.3.240.0090.02212.62
5.3.230.0070.04012.67
5.3.220.0070.04312.57
5.3.210.0080.03312.60
5.3.200.0090.03412.43
5.3.190.0050.04312.70
5.3.180.0050.04312.58
5.3.170.0040.04012.70
5.3.160.0020.02612.54
5.3.150.0050.02812.55
5.3.140.0120.03212.66
5.3.130.0050.03312.61
5.3.120.0050.04312.62
5.3.110.0090.03512.58
5.3.100.0030.02412.27
5.3.90.0070.02012.46
5.3.80.0050.02312.31
5.3.70.0060.04012.30
5.3.60.0030.04312.18
5.3.50.0110.03112.33
5.3.40.0050.04112.29
5.3.30.0080.04012.14
5.3.20.0040.02512.09
5.3.10.0060.03812.00
5.3.00.0050.04112.05
5.2.170.0000.07011.24
5.2.160.0030.06011.20
5.2.150.0070.04011.21
5.2.140.0000.07011.15
5.2.130.0070.06311.16
5.2.120.0000.06011.20
5.2.110.0070.03311.15
5.2.100.0100.06311.10
5.2.90.0000.04711.10
5.2.80.0070.06011.19
5.2.70.0000.06711.06
5.2.60.0070.06011.04
5.2.50.0070.05711.03
5.2.40.0070.05710.90
5.2.30.0070.06010.96
5.2.20.0030.06710.86
5.2.10.0130.06010.88
5.2.00.0130.05310.57
5.1.60.0070.05310.09
5.1.50.0030.04010.07
5.1.40.0030.0539.97
5.1.30.0030.05310.30
5.1.20.0070.05010.32
5.1.10.0130.05010.12
5.1.00.0070.0409.99
5.0.50.0000.0408.38
5.0.40.0030.0438.35
5.0.30.0000.0708.16
5.0.20.0030.0308.19
5.0.10.0070.0408.25
5.0.00.0100.0337.99
4.4.90.0000.0377.69
4.4.80.0000.0377.69
4.4.70.0030.0377.71
4.4.60.0030.0277.71
4.4.50.0000.0377.71
4.4.40.0130.0377.80
4.4.30.0000.0237.80
4.4.20.0030.0337.80
4.4.10.0000.0407.80
4.4.00.0000.0377.80
4.3.110.0070.0377.80
4.3.100.0100.0277.80
4.3.90.0000.0377.80
4.3.80.0030.0337.80
4.3.70.0000.0207.80
4.3.60.0030.0177.80
4.3.50.0000.0237.80
4.3.40.0030.0237.80
4.3.30.0000.0377.80
4.3.20.0000.0407.80
4.3.10.0070.0307.80
4.3.00.0000.0337.80

preferences:
58.29 ms | 401 KiB | 5 Q