3v4l.org

run code in 200+ PHP versions simultaneously
<?php function partition(&$arr, $left, $right) { $pivot = $arr[($left + $right)/2]; while ($left <= $right) { while ($arr[$left] < $pivot) $left++; while ($arr[$right] > $pivot) $right--; if ($left <= $right) { $tmp = $arr[$left]; $arr[$left] = $arr[$right]; $arr[$right] = $tmp; $left++; $right--; } } return $left; } function quickSort($arr, $left = 0, $right = null) { if(!$right) $right = (count($arr)-1); $index = partition($arr, $left, $right); if ($left < $index - 1) { $arr = quickSort($arr, $left, $index - 1); } if ($index < $right) { $arr = quickSort($arr, $index, $right); } return $arr; } $sortMe = [8,11,10,13,4,12,56,9]; print_r(quickSort($sortMe));

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)
7.4.10.0100.00714.82
7.4.00.0090.00714.88
7.3.130.0120.00614.80
7.3.120.0110.00714.74
7.3.110.0090.00914.77
7.3.100.0090.00814.83
7.3.90.0100.00814.89
7.3.80.0070.01114.79
7.3.70.0090.00714.74
7.3.60.0110.00714.67
7.3.50.0070.01014.66
7.3.40.0090.00814.66
7.3.30.0090.00914.70
7.3.20.0100.00914.75
7.3.10.0100.00714.75
7.3.00.0100.00814.76
7.2.260.0100.00814.96
7.2.250.0120.00714.96
7.2.240.0120.00715.02
7.2.230.0090.00914.95
7.2.220.0120.00715.01
7.2.210.0110.00614.99
7.2.200.0110.00714.92
7.2.190.0100.00714.97
7.2.180.0090.00814.85
7.2.170.0120.00514.92
7.2.160.0100.00914.92
7.2.150.0100.01115.14
7.2.140.0100.00915.02
7.2.130.0130.00715.01
7.2.120.0080.01015.05
7.2.110.0130.00815.01
7.2.100.0120.00714.97
7.2.90.0130.00915.06
7.2.80.0110.01015.04
7.2.70.0090.01015.01
7.2.60.0090.01015.01
7.2.50.0100.00715.02
7.2.40.0080.00915.00
7.2.30.0110.00614.97
7.2.20.0080.01215.08
7.2.10.0100.01015.02
7.2.00.0170.00815.00
7.1.330.0080.00814.05
7.1.320.0070.01013.68
7.1.310.0120.00814.18
7.1.300.0090.00914.03
7.1.290.0070.01213.98
7.1.280.0150.00314.05
7.1.270.0150.00313.91
7.1.260.0130.00613.95
7.1.250.0130.01013.70
7.1.240.0140.00513.74
7.1.230.0470.01413.88
7.1.220.0150.00414.06
7.1.210.0130.00713.76
7.1.200.0120.00813.67
7.1.190.0180.00314.05
7.1.180.0130.00613.98
7.1.170.0160.00414.13
7.1.160.0140.00413.92
7.1.150.0140.00713.73
7.1.140.0120.00613.86
7.1.130.0040.01413.79
7.1.120.0130.01014.08
7.1.110.0160.00414.18
7.1.100.0110.01114.12
7.1.90.0100.01114.08
7.1.80.0100.01014.04
7.1.70.0120.00513.85
7.1.60.0090.00914.07
7.1.50.0050.01113.80
7.1.40.0100.01114.18
7.1.30.0110.00813.87
7.1.20.0070.01313.92
7.1.10.0060.01313.63
7.1.00.0120.00613.81
7.0.330.0140.00313.58
7.0.320.0100.01013.55
7.0.310.0160.00313.68
7.0.300.0140.00613.61
7.0.290.0070.01013.71
7.0.280.0190.00313.62
7.0.270.0150.00313.68
7.0.260.0070.01113.67
7.0.250.0200.00013.60
7.0.240.0100.00813.75
7.0.230.0170.00313.41
7.0.220.0030.01213.42
7.0.210.0130.00513.71
7.0.200.0080.01213.73
7.0.190.0090.01613.43
7.0.180.0140.00513.38
7.0.170.0090.00913.42
7.0.160.0190.00013.70
7.0.150.0120.00313.66
7.0.140.0120.00413.43
7.0.130.0120.00513.54
7.0.120.0090.00913.57
7.0.110.0180.00313.56
7.0.100.0150.00413.46
7.0.90.0070.00813.83
7.0.80.0080.01113.60
7.0.70.0100.00713.61
7.0.60.0040.01513.69
7.0.50.0120.00713.69
7.0.40.0110.00713.65
7.0.30.0350.00713.61
7.0.20.0200.00613.68
7.0.10.0050.01513.66
7.0.00.0200.00013.79
5.6.400.0110.00914.55
5.6.390.0110.01114.32
5.6.380.0100.00814.04
5.6.370.0120.00314.12
5.6.360.0160.01114.55
5.6.350.0150.00314.30
5.6.340.0160.00814.29
5.6.330.0090.00914.64
5.6.320.0140.00514.36
5.6.310.0090.01114.53
5.6.300.0130.00514.42
5.6.290.0160.00314.41
5.6.280.0030.01514.20
5.6.270.0090.00914.12
5.6.260.0150.00214.41
5.6.250.0140.00714.09
5.6.240.0160.00314.41
5.6.230.0040.01614.43
5.6.220.0100.01014.32
5.6.210.0150.00614.61
5.6.200.0150.00414.45
5.6.190.0140.00914.50
5.6.180.0090.00914.27
5.6.170.0140.00514.49
5.6.160.0130.00714.44
5.6.150.0080.01214.27
5.6.140.0150.01114.18
5.6.130.0120.00614.52
5.6.120.0180.00514.49
5.6.110.0170.00614.39
5.6.100.0220.00714.45
5.6.90.0180.00714.36
5.6.80.0080.01114.30
5.6.70.0080.01514.14
5.6.60.0140.00714.42
5.6.50.0200.00814.36
5.6.40.0120.00814.35
5.6.30.0090.01014.23
5.6.20.0050.01414.29
5.6.10.0110.01414.35
5.6.00.0110.00714.29
5.5.380.0170.00314.40
5.5.370.0150.00714.06
5.5.360.0100.01014.30
5.5.350.0140.00814.30
5.5.340.0110.01214.18
5.5.330.0100.01014.25
5.5.320.0130.00814.16
5.5.310.0080.01114.36
5.5.300.0120.00813.98
5.5.290.0090.01214.54
5.5.280.0100.01413.98
5.5.270.0180.00914.59
5.5.260.0140.01414.44
5.5.250.0100.01014.51
5.5.240.0130.00914.21
5.5.230.0120.00914.35
5.5.220.0200.00714.61
5.5.210.0180.00414.41
5.5.200.0090.00914.27
5.5.190.0000.01714.54
5.5.180.0070.01114.19
5.5.170.0140.00714.32
5.5.160.0090.00914.21
5.5.150.0160.00414.07
5.5.140.0160.00614.42
5.5.130.0070.01214.55
5.5.120.0140.00814.38
5.5.110.0170.00314.55
5.5.100.0070.01114.18
5.5.90.0140.00614.18
5.5.80.0170.01014.16
5.5.70.0200.00014.34
5.5.60.0110.01114.18
5.5.50.0200.00014.11
5.5.40.0110.00714.25
5.5.30.0080.01114.47
5.5.20.0070.01713.85
5.5.10.0110.00813.77
5.5.00.0100.00914.37
5.4.450.0100.01012.70
5.4.440.0150.00012.70
5.4.430.0090.00912.70
5.4.420.0160.00012.70
5.4.410.0110.00812.70
5.4.400.0030.01112.70
5.4.390.0090.00912.70
5.4.380.0120.00912.70
5.4.370.0110.00412.70
5.4.360.0090.00612.70
5.4.350.0070.00812.70
5.4.340.0170.00312.70
5.4.330.0130.00812.70
5.4.320.0070.00712.70
5.4.310.0090.00912.70
5.4.300.0130.00312.70
5.4.290.0100.00512.70
5.4.280.0060.00912.70
5.4.270.0060.00812.70
5.4.260.0060.00612.70
5.4.250.0120.00312.70
5.4.240.0100.01012.70
5.4.230.0070.00712.70
5.4.220.0090.00612.70
5.4.210.0060.00912.70
5.4.200.0110.00812.70
5.4.190.0040.01112.70
5.4.180.0090.00612.70
5.4.170.0110.00412.70
5.4.160.0030.01212.70
5.4.150.0060.00912.70
5.4.140.0160.00012.70
5.4.130.0060.00912.70
5.4.120.0110.00212.70
5.4.110.0130.00312.70
5.4.100.0090.00712.70
5.4.90.0130.00312.70
5.4.80.0140.00512.70
5.4.70.0080.01112.70
5.4.60.0160.00512.70
5.4.50.0110.00412.70
5.4.40.0060.00912.70
5.4.30.0120.00612.70
5.4.20.0110.00512.70
5.4.10.0090.00612.70
5.4.00.0060.01012.70
5.3.290.0050.00812.70
5.3.280.0080.00612.70
5.3.270.0050.00812.70
5.3.260.0090.00312.70
5.3.250.0060.01212.70
5.3.240.0100.00312.70
5.3.230.0040.00912.70
5.3.220.0030.00912.70
5.3.210.0090.00412.70
5.3.200.0110.00312.70
5.3.190.0110.00812.70
5.3.180.0040.01512.70
5.3.170.0080.00512.70
5.3.160.0030.01012.70
5.3.150.0080.00612.70
5.3.140.0090.00512.70
5.3.130.0050.00912.70
5.3.120.0100.00512.70
5.3.110.0110.00412.70
5.3.100.0060.00612.70
5.3.90.0100.00312.70
5.3.80.0100.00212.70
5.3.70.0070.00712.70
5.3.60.0110.00512.70
5.3.50.0040.01312.70
5.3.40.0120.00412.70
5.3.30.0130.00012.70
5.3.20.0030.00912.70
5.3.10.0070.00512.70
5.3.00.0090.00512.70
5.2.170.0050.00812.70
5.2.160.0060.00612.70
5.2.150.0080.00412.70
5.2.140.0080.00312.70
5.2.130.0110.00012.70
5.2.120.0110.00012.70
5.2.110.0110.00012.70
5.2.100.0080.00412.70
5.2.90.0080.00412.70
5.2.80.0000.01112.70
5.2.70.0110.00012.70
5.2.60.0110.00012.70
5.2.50.0060.00612.70
5.2.40.0050.00512.70
5.2.30.0050.00512.70
5.2.20.0070.00712.70
5.2.10.0030.00712.70
5.2.00.0100.00012.70
5.1.60.0090.00012.70
5.1.50.0100.00012.70
5.1.40.0050.00512.70
5.1.30.0000.00912.70
5.1.20.0100.00312.70
5.1.10.0080.00412.70
5.1.00.0090.00012.70
5.0.50.0080.00012.70
5.0.40.0080.00012.70
5.0.30.0110.00012.70
5.0.20.0000.00912.70
5.0.10.0030.00612.70
5.0.00.0050.00412.70
4.4.90.0050.00312.70
4.4.80.0040.00412.70
4.4.70.0060.00012.70
4.4.60.0040.00412.70
4.4.50.0040.00212.70
4.4.40.0060.00012.70
4.4.30.0030.00312.70
4.4.20.0080.00012.70
4.4.10.0000.00712.70
4.4.00.0050.00212.70
4.3.110.0070.00012.70
4.3.100.0030.00312.70
4.3.90.0000.00712.70
4.3.80.0060.00312.70
4.3.70.0000.00612.70
4.3.60.0040.00212.70
4.3.50.0030.00312.70
4.3.40.0000.00712.70
4.3.30.0030.00312.70
4.3.20.0000.00512.70
4.3.10.0000.00512.70
4.3.00.0060.00012.70