3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ [15, 16, 8, 1], [2, 3, 4, 7], [9, 11, 19, 6] ]; $sortedArr = []; function bubbleSortRowCol($arr) { $colCount = 0; $tempArr = []; $columnArr = []; foreach($arr as $key => $row) { $tempArr[$key] = bubbleSort($row); $colCount = count($row); } for($i = 0; $i < $colCount; $i++) { $columnArr[] = bubbleSort(array_column($i)); } if($columnArr !== $sortedArr) { bubbleSortRowCol($columnArr); } return $tempArr; } function fullSortArr($arr) { $fullArr = []; $tempArr = []; $countArr = []; $n = 0; foreach($arr as $value) { $fullArr = array_merge($fullArr, $value); $countArr[] = count($value); } asort($fullArr); foreach($countArr as $key => $length) { $tempArr[] = array_slice($fullArr, $n, $length); $n += $length; } return $tempArr; } function bubbleSort($arr) { $sorted = false; while (false === $sorted) { $sorted = true; for ($i = 0; $i < count($arr) - 1; $i++) { $current = $arr[$i]; $next = $arr[$i + 1]; if ($next < $current) { $arr[$i] = $next; $arr[$i + 1] = $current; $sorted = false; } } } return $arr; } $sortedArr = fullSortArr($arr); print_r(bubbleSortRowCol($arr));

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.0110.00716.88
8.3.50.0090.00922.11
8.3.40.0120.00619.01
8.3.30.0060.00918.74
8.3.20.0040.00420.16
8.3.10.0080.00023.53
8.3.00.0000.00919.84
8.2.180.0120.00317.00
8.2.170.0140.00722.96
8.2.160.0060.00920.27
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0060.00321.13
8.2.120.0060.00326.35
8.2.110.0040.00420.39
8.2.100.0070.00418.16
8.2.90.0040.00419.20
8.2.80.0040.00417.97
8.2.70.0050.00317.75
8.2.60.0030.00618.03
8.2.50.0030.00618.07
8.2.40.0080.00021.11
8.2.30.0050.00220.55
8.2.20.0080.00017.86
8.2.10.0000.00718.23
8.2.00.0030.00518.06
8.1.280.0070.00725.92
8.1.270.0060.00318.95
8.1.260.0040.00428.09
8.1.250.0030.00628.09
8.1.240.0060.00322.18
8.1.230.0090.00317.77
8.1.220.0000.00817.78
8.1.210.0080.00018.77
8.1.200.0030.00717.35
8.1.190.0030.00617.35
8.1.180.0060.00318.10
8.1.170.0040.00418.66
8.1.160.0040.00420.69
8.1.150.0000.00818.93
8.1.140.0000.00819.61
8.1.130.0000.00717.80
8.1.120.0040.00417.49
8.1.110.0030.00517.49
8.1.100.0040.00417.52
8.1.90.0000.01217.42
8.1.80.0040.00417.43
8.1.70.0070.00017.38
8.1.60.0090.00017.50
8.1.50.0030.00617.49
8.1.40.0000.00917.48
8.1.30.0030.00617.71
8.1.20.0030.00517.71
8.1.10.0040.00417.50
8.1.00.0040.00417.44
8.0.300.0070.00018.77
8.0.290.0040.00416.88
8.0.280.0040.00418.42
8.0.270.0030.00317.25
8.0.260.0030.00317.30
8.0.250.0030.00316.98
8.0.240.0030.00316.90
8.0.230.0000.00716.95
8.0.220.0030.00317.00
8.0.210.0000.00716.91
8.0.200.0030.00317.04
8.0.190.0030.00616.93
8.0.180.0040.00416.98
8.0.170.0050.00317.09
8.0.160.0030.00316.99
8.0.150.0050.00516.85
8.0.140.0040.00416.85
8.0.130.0030.00313.36
8.0.120.0040.00416.94
8.0.110.0000.00716.83
8.0.100.0000.00816.86
8.0.90.0000.00716.93
8.0.80.0090.00617.04
8.0.70.0040.00417.05
8.0.60.0000.00817.04
8.0.50.0000.00717.01
8.0.30.0100.00717.06
8.0.20.0070.01117.40
8.0.10.0000.00717.14
8.0.00.0100.00816.76
7.4.330.0090.00015.51
7.4.320.0070.00016.63
7.4.300.0000.00716.63
7.4.290.0080.00016.76
7.4.280.0040.00416.58
7.4.270.0040.00416.74
7.4.260.0000.00816.61
7.4.250.0040.00416.73
7.4.240.0050.00216.72
7.4.230.0040.00416.85
7.4.220.0060.01316.70
7.4.210.0110.00816.90
7.4.200.0070.00016.70
7.4.160.0510.01717.45
7.4.150.0530.01717.40
7.4.140.0360.02617.86
7.4.130.0260.02117.21
7.4.120.0220.00817.15
7.4.110.0740.01717.16
7.4.100.0210.00716.75
7.4.90.0650.04117.27
7.4.80.0660.02719.39
7.4.70.0630.01117.14
7.4.60.0100.01317.14
7.4.50.0130.00316.92
7.4.40.0150.00916.79
7.4.30.0120.01217.20
7.4.00.0040.01515.41
7.3.330.0730.069121.93
7.3.320.0430.067121.49
7.3.310.0030.00316.43
7.3.300.0030.00616.57
7.3.290.0030.00316.63
7.3.280.0100.01216.72
7.3.270.0110.01117.40
7.3.260.0100.01616.57
7.3.250.0430.01717.13
7.3.240.0190.00916.93
7.3.230.0090.01216.73
7.3.210.0030.01616.74
7.3.200.0060.01316.60
7.3.190.0100.01016.52
7.3.180.0210.01717.19
7.3.170.0110.00816.65
7.3.160.0090.01216.63
7.2.330.0120.00916.70
7.2.320.0230.02917.17
7.2.310.0460.02017.43
7.2.300.0330.01217.36
7.2.290.0130.00616.86
7.2.60.0030.00716.66
7.2.00.0080.00819.15
7.1.200.0110.00815.75
7.1.100.0060.00616.70
7.1.70.0070.00017.01
7.1.60.0130.01019.13
7.1.50.0060.00617.22
7.1.00.0100.07022.27
7.0.200.0060.00316.87
7.0.60.0100.07720.25
7.0.50.0170.07318.15
7.0.40.0070.04319.91
7.0.30.0400.07019.95
7.0.20.0170.04319.81
7.0.10.0030.04319.80
7.0.00.0070.08019.98
5.6.280.0000.04721.84
5.6.210.0070.04721.25
5.6.200.0130.08320.38
5.6.190.0030.07721.18
5.6.180.0400.04021.35
5.6.170.0230.03721.17
5.6.160.0070.05021.14
5.6.150.0030.04319.34
5.6.140.0030.08318.92
5.6.130.0130.08720.41
5.6.120.0070.09023.35
5.6.110.0000.04722.18
5.6.100.0200.06721.89
5.6.90.0200.07021.71
5.6.80.0170.06321.36
5.5.350.0100.07321.56
5.5.340.0070.03719.14
5.5.330.0030.08020.98
5.5.320.0400.06722.17
5.5.310.0270.04720.93
5.5.300.0070.06718.71
5.5.290.0030.05718.70
5.5.280.0130.05021.44
5.5.270.0100.07021.78
5.5.260.0130.06721.54
5.5.250.0100.07321.55
5.5.240.0200.07020.93

preferences:
55.26 ms | 401 KiB | 5 Q